home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / network / sunacm / beta / 1_13diff next >
Encoding:
Text File  |  1994-05-20  |  407.1 KB  |  16,378 lines

  1. diff -u --new-file --recursive linux.old/.config linux/.config
  2. --- linux.old/.config    Thu Jan  1 01:00:00 1970
  3. +++ linux/.config    Fri May 20 18:51:55 1994
  4. @@ -0,0 +1,125 @@
  5. +#
  6. +# Automatically generated make config: don't edit
  7. +#
  8. +
  9. +#
  10. +# General setup
  11. +#
  12. +  CONFIG_MATH_EMULATION = CONFIG_MATH_EMULATION
  13. +# CONFIG_BLK_DEV_HD is not set
  14. +# CONFIG_BLK_DEV_XD is not set
  15. +  CONFIG_NET = CONFIG_NET
  16. +# CONFIG_MAX_16M is not set
  17. +  CONFIG_SYSVIPC = CONFIG_SYSVIPC
  18. +# CONFIG_M486 is not set
  19. +
  20. +#
  21. +# Networking options
  22. +#
  23. +  CONFIG_INET = CONFIG_INET
  24. +
  25. +#
  26. +# (it is safe to leave these untouched)
  27. +#
  28. +# CONFIG_INET_RARP is not set
  29. +  CONFIG_INET_SNARL = CONFIG_INET_SNARL
  30. +# CONFIG_TCP_NAGLE_OFF is not set
  31. +  CONFIG_IPX = CONFIG_IPX
  32. +
  33. +#
  34. +# Program binary formats
  35. +#
  36. +# CONFIG_BINFMT_ELF is not set
  37. +# CONFIG_BINFMT_COFF is not set
  38. +
  39. +#
  40. +# SCSI support
  41. +#
  42. +  CONFIG_SCSI = CONFIG_SCSI
  43. +
  44. +#
  45. +# SCSI support type (disk, tape, CDrom)
  46. +#
  47. +  CONFIG_BLK_DEV_SD = CONFIG_BLK_DEV_SD
  48. +# CONFIG_CHR_DEV_ST is not set
  49. +# CONFIG_BLK_DEV_SR is not set
  50. +# CONFIG_CHR_DEV_SG is not set
  51. +
  52. +#
  53. +# SCSI low-level drivers
  54. +#
  55. +# CONFIG_SCSI_AHA152X is not set
  56. +  CONFIG_SCSI_AHA1542 = CONFIG_SCSI_AHA1542
  57. +# CONFIG_SCSI_AHA1740 is not set
  58. +# CONFIG_SCSI_FUTURE_DOMAIN is not set
  59. +# CONFIG_SCSI_GENERIC_NCR5380 is not set
  60. +# CONFIG_SCSI_PAS16 is not set
  61. +# CONFIG_SCSI_SEAGATE is not set
  62. +# CONFIG_SCSI_T128 is not set
  63. +# CONFIG_SCSI_ULTRASTOR is not set
  64. +# CONFIG_SCSI_7000FASST is not set
  65. +
  66. +#
  67. +# Network device support
  68. +#
  69. +  CONFIG_NETDEVICES = CONFIG_NETDEVICES
  70. +  CONFIG_SLIP = CONFIG_SLIP
  71. +  SL_COMPRESSED = SL_COMPRESSED
  72. +  CONFIG_SLAVE_BALANCING = CONFIG_SLAVE_BALANCING
  73. +# CONFIG_PLIP is not set
  74. +# CONFIG_NE2000 is not set
  75. +# CONFIG_WD80x3 is not set
  76. +# CONFIG_ULTRA is not set
  77. +# CONFIG_EL1 is not set
  78. +# CONFIG_EL2 is not set
  79. +# CONFIG_EL3 is not set
  80. +# CONFIG_HPLAN is not set
  81. +  CONFIG_LANCE = CONFIG_LANCE
  82. +# CONFIG_AT1700 is not set
  83. +# CONFIG_DEPCA is not set
  84. +# CONFIG_DE600 is not set
  85. +# CONFIG_ATP is not set
  86. +
  87. +#
  88. +# CD-ROM drivers
  89. +#
  90. +# CONFIG_CDU31A is not set
  91. +# CONFIG_MCD is not set
  92. +# CONFIG_SBPCD is not set
  93. +
  94. +#
  95. +# Filesystems
  96. +#
  97. +  CONFIG_MINIX_FS = CONFIG_MINIX_FS
  98. +# CONFIG_EXT_FS is not set
  99. +  CONFIG_EXT2_FS = CONFIG_EXT2_FS
  100. +# CONFIG_XIA_FS is not set
  101. +  CONFIG_MSDOS_FS = CONFIG_MSDOS_FS
  102. +  CONFIG_PROC_FS = CONFIG_PROC_FS
  103. +  CONFIG_NFS_FS = CONFIG_NFS_FS
  104. +# CONFIG_ISO9660_FS is not set
  105. +# CONFIG_HPFS_FS is not set
  106. +# CONFIG_SYSV_FS is not set
  107. +
  108. +#
  109. +# character devices
  110. +#
  111. +# CONFIG_PRINTER is not set
  112. +# CONFIG_BUSMOUSE is not set
  113. +# CONFIG_PSMOUSE is not set
  114. +# CONFIG_MS_BUSMOUSE is not set
  115. +# CONFIG_ATIXL_BUSMOUSE is not set
  116. +  CONFIG_SELECTION = CONFIG_SELECTION
  117. +# CONFIG_TAPE_QIC02 is not set
  118. +# CONFIG_FTAPE is not set
  119. +
  120. +#
  121. +# Sound
  122. +#
  123. +# CONFIG_SOUND is not set
  124. +
  125. +#
  126. +# Kernel hacking
  127. +#
  128. +# CONFIG_PROFILE is not set
  129. +  CONFIG_SCSI_CONSTANTS = CONFIG_SCSI_CONSTANTS
  130. diff -u --new-file --recursive linux.old/.version linux/.version
  131. --- linux.old/.version    Thu Jan  1 01:00:00 1970
  132. +++ linux/.version    Fri May 20 18:51:54 1994
  133. @@ -0,0 +1 @@
  134. +38
  135. Only in linux.old: CREDITS.orig
  136. Only in linux.old: Configure.orig
  137. Only in linux.old: Makefile.orig
  138. Only in linux.old: README.orig
  139. Binary files linux.old/boot/bootsect and linux/boot/bootsect differ
  140. diff -u --new-file --recursive linux.old/boot/bootsect.s linux/boot/bootsect.s
  141. --- linux.old/boot/bootsect.s    Thu Jan  1 01:00:00 1970
  142. +++ linux/boot/bootsect.s    Fri May 20 18:49:28 1994
  143. @@ -0,0 +1,662 @@
  144. +# 1 "boot/bootsect.S"
  145. +!
  146. +! SYS_SIZE is the number of clicks (16 bytes) to be loaded.
  147. +! 0x7F00 is 0x7F000 bytes = 508kB, more than enough for current
  148. +! versions of 1 which compress the kernel
  149. +!
  150. +# 1 "/usr/src/v11/linux/include/linux/config.h" 1
  151. +
  152. +
  153. +
  154. +# 1 "/usr/src/v11/linux/include/linux/autoconf.h" 1
  155. +
  156. +
  157. +
  158. +
  159. +
  160. +
  161. +
  162. +
  163. +
  164. +
  165. +
  166. +
  167. +
  168. +
  169. +
  170. +
  171. +
  172. +
  173. +
  174. +
  175. +
  176. +
  177. +
  178. +
  179. +
  180. +
  181. +
  182. +
  183. +
  184. +
  185. +
  186. +
  187. +
  188. +
  189. +
  190. +
  191. +
  192. +
  193. +
  194. +
  195. +
  196. +
  197. +
  198. +
  199. +
  200. +
  201. +
  202. +
  203. +
  204. +
  205. +
  206. +
  207. +
  208. +
  209. +
  210. +
  211. +
  212. +
  213. +
  214. +
  215. +
  216. +
  217. +
  218. +
  219. +
  220. +
  221. +
  222. +
  223. +
  224. +
  225. +
  226. +
  227. +
  228. +
  229. +
  230. +
  231. +
  232. +
  233. +
  234. +
  235. +
  236. +
  237. +
  238. +
  239. +
  240. +
  241. +
  242. +
  243. +
  244. +
  245. +
  246. +
  247. +
  248. +
  249. +
  250. +
  251. +
  252. +
  253. +
  254. +
  255. +
  256. +
  257. +
  258. +
  259. +
  260. +
  261. +
  262. +
  263. +
  264. +
  265. +
  266. +
  267. +
  268. +
  269. +
  270. +
  271. +
  272. +
  273. +
  274. +
  275. +
  276. +
  277. +
  278. +
  279. +
  280. +# 4 "/usr/src/v11/linux/include/linux/config.h" 2
  281. +
  282. +
  283. +
  284. +
  285. +
  286. +
  287. +
  288. +
  289. +
  290. +
  291. +
  292. +
  293. +
  294. +
  295. +
  296. +
  297. +
  298. +
  299. +
  300. +
  301. +
  302. +
  303. +
  304. +
  305. +
  306. +
  307. +
  308. +
  309. +
  310. +
  311. +
  312. +
  313. +
  314. +
  315. +
  316. +
  317. +
  318. +
  319. +
  320. +
  321. +
  322. +
  323. +
  324. +
  325. +
  326. +
  327. +
  328. +
  329. +
  330. +
  331. +
  332. +
  333. +
  334. +
  335. +
  336. +
  337. +
  338. +
  339. +
  340. +
  341. +
  342. +
  343. +
  344. +
  345. +
  346. +
  347. +
  348. +
  349. +
  350. +
  351. +
  352. +
  353. +
  354. +
  355. +
  356. +
  357. +
  358. +
  359. +
  360. +
  361. +
  362. +
  363. +
  364. +
  365. +
  366. +
  367. +
  368. +# 6 "boot/bootsect.S" 2
  369. +
  370. +SYSSIZE = 0x7F00
  371. +!
  372. +!    bootsect.s        Copyright (C) 1991, 1992 Linus Torvalds
  373. +!    modified by Drew Eckhardt
  374. +!    modified by Bruce Evans (bde)
  375. +!
  376. +! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves
  377. +! itself out of the way to address 0x90000, and jumps there.
  378. +!
  379. +! bde - should not jump blindly, there may be systems with only 512K low
  380. +! memory.  Use int 0x12 to get the top of memory, etc.
  381. +!
  382. +! It then loads 'setup' directly after itself (0x90200), and the system
  383. +! at 0x10000, using BIOS interrupts. 
  384. +!
  385. +! NOTE! currently system is at most (8*65536-4096) bytes long. This should 
  386. +! be no problem, even in the future. I want to keep it simple. This 508 kB
  387. +! kernel size should be enough, especially as this doesn't contain the
  388. +! buffer cache as in minix (and especially now that the kernel is 
  389. +! compressed :-)
  390. +!
  391. +! The loader has been made as simple as possible, and continuos
  392. +! read errors will result in a unbreakable loop. Reboot by hand. It
  393. +! loads pretty fast by getting whole tracks at a time whenever possible.
  394. +
  395. +.text
  396. +
  397. +SETUPSECS = 4                ! nr of setup-sectors
  398. +BOOTSEG   = 0x07C0            ! original address of boot-sector
  399. +INITSEG   = 0x9000            ! we move boot here - out of the way
  400. +SETUPSEG  = 0x9020        ! setup starts here
  401. +SYSSEG    = 0x1000            ! system loaded at 0x10000 (65536).
  402. +
  403. +! ROOT_DEV & SWAP_DEV are now written by "build".
  404. +ROOT_DEV = 0
  405. +SWAP_DEV = 0
  406. +
  407. +
  408. +
  409. +
  410. +
  411. +
  412. +
  413. +
  414. +
  415. +
  416. +! ld86 requires an entry symbol. This may as well be the usual one.
  417. +.globl    _main
  418. +_main:
  419. +
  420. +
  421. +
  422. +    mov    ax,#BOOTSEG
  423. +    mov    ds,ax
  424. +    mov    ax,#INITSEG
  425. +    mov    es,ax
  426. +    mov    cx,#256
  427. +    sub    si,si
  428. +    sub    di,di
  429. +    cld
  430. +    rep
  431. +    movsw
  432. +    jmpi    go,INITSEG
  433. +
  434. +go:    mov    ax,cs        
  435. +    mov    dx,#0x4000-12    ! 0x4000 is arbitrary value >= length of
  436. +                ! bootsect + length of setup + room for stack
  437. +                ! 12 is disk parm size
  438. +
  439. +! bde - changed 0xff00 to 0x4000 to use debugger at 0x6400 up (bde).  We
  440. +! wouldn't have to worry about this if we checked the top of memory.  Also
  441. +! my BIOS can be configured to put the wini drive tables in high memory
  442. +! instead of in the vector table.  The old stack might have clobbered the
  443. +! drive table.
  444. +
  445. +    mov    ds,ax
  446. +    mov    es,ax
  447. +    mov    ss,ax        ! put stack at INITSEG:0x4000-12.
  448. +    mov    sp,dx
  449. +
  450. +
  451. +
  452. +
  453. +
  454. +
  455. +
  456. +
  457. +
  458. +
  459. +
  460. +
  461. +
  462. +
  463. +
  464. +
  465. +
  466. +    push    #0
  467. +    pop    fs
  468. +    mov    bx,#0x78        ! fs:bx is parameter table address
  469. +    seg fs
  470. +    lgs    si,(bx)            ! gs:si is source
  471. +
  472. +    mov    di,dx            ! es:di is destination
  473. +    mov    cx,#6            ! copy 12 bytes
  474. +    cld
  475. +
  476. +    rep
  477. +    seg gs
  478. +    movsw
  479. +
  480. +    mov    di,dx
  481. +    movb    4(di),*18        ! patch sector count
  482. +
  483. +    seg fs
  484. +    mov    (bx),di
  485. +    seg fs
  486. +    mov    2(bx),es
  487. +
  488. +    mov    ax,cs
  489. +    mov    fs,ax
  490. +    mov    gs,ax
  491. +    
  492. +    xor    ah,ah            ! reset FDC 
  493. +    xor    dl,dl
  494. +    int     0x13    
  495. +
  496. +! load the setup-sectors directly after the bootblock.
  497. +! Note that 'es' is already set up.
  498. +
  499. +load_setup:
  500. +    xor    dx, dx            ! drive 0, head 0
  501. +    mov    cx,#0x0002        ! sector 2, track 0
  502. +    mov    bx,#0x0200        ! address = 512, in INITSEG
  503. +    mov    ax,#0x0200+SETUPSECS    ! service 2, nr of sectors
  504. +                    ! (assume all on head 0, track 0)
  505. +    int    0x13            ! read it
  506. +    jnc    ok_load_setup        ! ok - continue
  507. +
  508. +    push    ax            ! dump error code
  509. +    call    print_nl
  510. +    mov    bp, sp
  511. +    call    print_hex
  512. +    pop    ax    
  513. +    
  514. +    xor    dl, dl            ! reset FDC
  515. +    xor    ah, ah
  516. +    int    0x13
  517. +    jmp    load_setup
  518. +
  519. +ok_load_setup:
  520. +
  521. +! Get disk drive parameters, specifically nr of sectors/track
  522. +
  523. +# 170 "boot/bootsect.S"
  524. +
  525. +
  526. +! It seems that there is no BIOS call to get the number of sectors.  Guess
  527. +! 18 sectors if sector 18 can be read, 15 if sector 15 can be read.
  528. +! Otherwise guess 9.
  529. +
  530. +    xor    dx, dx            ! drive 0, head 0
  531. +    mov    cx,#0x0012        ! sector 18, track 0
  532. +    mov    bx,#0x0200+SETUPSECS*0x200  ! address after setup (es = cs)
  533. +    mov    ax,#0x0201        ! service 2, 1 sector
  534. +    int    0x13
  535. +    jnc    got_sectors
  536. +    mov    cl,#0x0f        ! sector 15
  537. +    mov    ax,#0x0201        ! service 2, 1 sector
  538. +    int    0x13
  539. +    jnc    got_sectors
  540. +    mov    cl,#0x09
  541. +
  542. +
  543. +
  544. +got_sectors:
  545. +    seg cs
  546. +    mov    sectors,cx
  547. +    mov    ax,#INITSEG
  548. +    mov    es,ax
  549. +
  550. +! Print some inane message
  551. +
  552. +    mov    ah,#0x03        ! read cursor pos
  553. +    xor    bh,bh
  554. +    int    0x10
  555. +    
  556. +    mov    cx,#9
  557. +    mov    bx,#0x0007        ! page 0, attribute 7 (normal)
  558. +    mov    bp,#msg1
  559. +    mov    ax,#0x1301        ! write string, move cursor
  560. +    int    0x10
  561. +
  562. +! ok, we've written the message, now
  563. +! we want to load the system (at 0x10000)
  564. +
  565. +    mov    ax,#SYSSEG
  566. +    mov    es,ax        ! segment of 0x010000
  567. +    call    read_it
  568. +    call    kill_motor
  569. +    call    print_nl
  570. +
  571. +! After that we check which root-device to use. If the device is
  572. +! defined (!= 0), nothing is done and the given device is used.
  573. +! Otherwise, either /dev/PS0 (2,28) or /dev/at0 (2,8), depending
  574. +! on the number of sectors that the BIOS reports currently.
  575. +
  576. +    seg cs
  577. +    mov    ax,root_dev
  578. +    or    ax,ax
  579. +    jne    root_defined
  580. +    seg cs
  581. +    mov    bx,sectors
  582. +    mov    ax,#0x0208        ! /dev/ps0 - 1.2Mb
  583. +    cmp    bx,#15
  584. +    je    root_defined
  585. +    mov    ax,#0x021c        ! /dev/PS0 - 1.44Mb
  586. +    cmp    bx,#18
  587. +    je    root_defined
  588. +    mov    ax,#0x0200        ! /dev/fd0 - autodetect
  589. +root_defined:
  590. +    seg cs
  591. +    mov    root_dev,ax
  592. +
  593. +! after that (everyting loaded), we jump to
  594. +! the setup-routine loaded directly after
  595. +! the bootblock:
  596. +
  597. +    jmpi    0,SETUPSEG
  598. +
  599. +! This routine loads the system at address 0x10000, making sure
  600. +! no 64kB boundaries are crossed. We try to load it as fast as
  601. +! possible, loading whole tracks whenever we can.
  602. +!
  603. +! in:    es - starting address segment (normally 0x1000)
  604. +!
  605. +sread:    .word 1+SETUPSECS    ! sectors read of current track
  606. +head:    .word 0            ! current head
  607. +track:    .word 0            ! current track
  608. +
  609. +read_it:
  610. +    mov ax,es
  611. +    test ax,#0x0fff
  612. +die:    jne die            ! es must be at 64kB boundary
  613. +    xor bx,bx        ! bx is starting address within segment
  614. +rp_read:
  615. +    mov ax,es
  616. +    sub ax,#SYSSEG
  617. +    cmp ax,syssize        ! have we loaded all yet?
  618. +    jbe ok1_read
  619. +    ret
  620. +ok1_read:
  621. +    seg cs
  622. +    mov ax,sectors
  623. +    sub ax,sread
  624. +    mov cx,ax
  625. +    shl cx,#9
  626. +    add cx,bx
  627. +    jnc ok2_read
  628. +    je ok2_read
  629. +    xor ax,ax
  630. +    sub ax,bx
  631. +    shr ax,#9
  632. +ok2_read:
  633. +    call read_track
  634. +    mov cx,ax
  635. +    add ax,sread
  636. +    seg cs
  637. +    cmp ax,sectors
  638. +    jne ok3_read
  639. +    mov ax,#1
  640. +    sub ax,head
  641. +    jne ok4_read
  642. +    inc track
  643. +ok4_read:
  644. +    mov head,ax
  645. +    xor ax,ax
  646. +ok3_read:
  647. +    mov sread,ax
  648. +    shl cx,#9
  649. +    add bx,cx
  650. +    jnc rp_read
  651. +    mov ax,es
  652. +    add ah,#0x10
  653. +    mov es,ax
  654. +    xor bx,bx
  655. +    jmp rp_read
  656. +
  657. +read_track:
  658. +    pusha
  659. +    pusha    
  660. +    mov    ax, #0xe2e     ! loading... message 2e = .
  661. +    mov    bx, #7
  662. +     int    0x10
  663. +    popa        
  664. +
  665. +    mov    dx,track
  666. +    mov    cx,sread
  667. +    inc    cx
  668. +    mov    ch,dl
  669. +    mov    dx,head
  670. +    mov    dh,dl
  671. +    and    dx,#0x0100
  672. +    mov    ah,#2
  673. +    
  674. +    push    dx                ! save for error dump
  675. +    push    cx
  676. +    push    bx
  677. +    push    ax
  678. +
  679. +    int    0x13
  680. +    jc    bad_rt
  681. +    add    sp, #8
  682. +    popa
  683. +    ret
  684. +
  685. +bad_rt:    push    ax                ! save error code
  686. +    call    print_all            ! ah = error, al = read
  687. +    
  688. +    
  689. +    xor ah,ah
  690. +    xor dl,dl
  691. +    int 0x13
  692. +    
  693. +
  694. +    add    sp, #10
  695. +    popa    
  696. +    jmp read_track
  697. +
  698. +
  699. +
  700. +
  701. +
  702. +
  703. +
  704. +
  705. +
  706. +
  707. +
  708. +
  709. +
  710. +print_all:
  711. +    mov    cx, #5        ! error code + 4 registers
  712. +    mov    bp, sp    
  713. +
  714. +print_loop:
  715. +    push    cx        ! save count left
  716. +    call    print_nl    ! nl for readability
  717. +
  718. +    cmp    cl, 5
  719. +    jae    no_reg        ! see if register name is needed
  720. +    
  721. +    mov    ax, #0xe05 + 'A - 1
  722. +    sub    al, cl
  723. +    int    0x10
  724. +
  725. +    mov    al, #'X
  726. +    int    0x10
  727. +
  728. +    mov    al, #':
  729. +    int    0x10
  730. +
  731. +no_reg:
  732. +    add    bp, #2        ! next register
  733. +    call    print_hex    ! print it
  734. +    pop    cx
  735. +    loop    print_loop
  736. +    ret
  737. +
  738. +print_nl:
  739. +    mov    ax, #0xe0d    ! CR
  740. +    int    0x10
  741. +    mov    al, #0xa    ! LF
  742. +    int     0x10
  743. +    ret
  744. +
  745. +
  746. +
  747. +
  748. +
  749. +
  750. +print_hex:
  751. +    mov    cx, #4        ! 4 hex digits
  752. +    mov    dx, (bp)    ! load word into dx
  753. +print_digit:
  754. +    rol    dx, #4        ! rotate so that lowest 4 bits are used
  755. +    mov    ah, #0xe    
  756. +    mov    al, dl        ! mask off so we have only next nibble
  757. +    and    al, #0xf
  758. +    add    al, #'0        ! convert to 0-based digit
  759. +    cmp    al, #'9        ! check for overflow
  760. +    jbe    good_digit
  761. +    add    al, #'A - '0 - 10
  762. +
  763. +good_digit:
  764. +    int    0x10
  765. +    loop    print_digit
  766. +    ret
  767. +
  768. +
  769. +
  770. +
  771. +
  772. +
  773. +
  774. +kill_motor:
  775. +    push dx
  776. +    mov dx,#0x3f2
  777. +    xor al, al
  778. +    outb
  779. +    pop dx
  780. +    ret
  781. +
  782. +sectors:
  783. +    .word 0
  784. +
  785. +msg1:
  786. +    .byte 13,10
  787. +    .ascii "Loading"
  788. +
  789. +.org 498
  790. +root_flags:
  791. +    .word 0
  792. +syssize:
  793. +    .word SYSSIZE
  794. +swap_dev:
  795. +    .word SWAP_DEV
  796. +ram_size:
  797. +    .word 0
  798. +vid_mode:
  799. +    .word 0xffff        
  800. +root_dev:
  801. +    .word ROOT_DEV
  802. +boot_flag:
  803. +    .word 0xAA55
  804. diff -u --new-file --recursive linux.old/boot/head.s linux/boot/head.s
  805. --- linux.old/boot/head.s    Thu Jan  1 01:00:00 1970
  806. +++ linux/boot/head.s    Fri May 20 18:49:28 1994
  807. @@ -0,0 +1,378 @@
  808. +# 1 "boot/head.S"
  809. +
  810. +
  811. +
  812. +
  813. +
  814. +
  815. +
  816. +
  817. +
  818. +
  819. +.text
  820. +.globl _idt,_gdt,
  821. +.globl _swapper_pg_dir,_pg0
  822. +.globl _empty_bad_page
  823. +.globl _empty_bad_page_table
  824. +.globl _empty_zero_page
  825. +.globl _tmp_floppy_area,_floppy_track_buffer
  826. +
  827. +# 1 "/usr/src/v11/linux/include/linux/tasks.h" 1
  828. +
  829. +
  830. +
  831. +
  832. +
  833. +
  834. +
  835. +
  836. +
  837. +# 19 "boot/head.S" 2
  838. +
  839. +# 1 "/usr/src/v11/linux/include/linux/segment.h" 1
  840. +
  841. +
  842. +
  843. +
  844. +
  845. +
  846. +
  847. +
  848. +
  849. +
  850. +# 20 "boot/head.S" 2
  851. +
  852. +
  853. +
  854. +
  855. +
  856. +
  857. +
  858. +
  859. +
  860. +
  861. +
  862. +startup_32:
  863. +    cld
  864. +    movl $(0x18),%eax
  865. +    mov %ax,%ds
  866. +    mov %ax,%es
  867. +    mov %ax,%fs
  868. +    mov %ax,%gs
  869. +    lss _stack_start,%esp
  870. +
  871. +
  872. +
  873. +    xorl %eax,%eax
  874. +    movl $__edata,%edi
  875. +    movl $__end,%ecx
  876. +    subl %edi,%ecx
  877. +    cld
  878. +    rep
  879. +    stosb
  880. +
  881. +
  882. +
  883. +
  884. +    call setup_idt
  885. +    xorl %eax,%eax
  886. +1:    incl %eax        # check that A20 really IS enabled
  887. +    movl %eax,0x000000    # loop forever if it isn't
  888. +    cmpl %eax,0x100000
  889. +    je 1b
  890. +
  891. +
  892. +
  893. +
  894. +
  895. +    pushl $0
  896. +    popfl
  897. +
  898. +
  899. +
  900. +
  901. +
  902. +    movl $0x90000,%esi
  903. +    movl $_empty_zero_page,%edi
  904. +    movl $512,%ecx
  905. +    cld
  906. +    rep
  907. +    movsl
  908. +    xorl %eax,%eax
  909. +    movl $512,%ecx
  910. +    rep
  911. +    stosl
  912. +    cmpw $(0xA33F),0x90020
  913. +    jne 1f
  914. +    movl $_empty_zero_page+2048,%edi
  915. +    movzwl 0x90022,%esi
  916. +    addl $(0x90000),%esi
  917. +    movl $2048,%ecx
  918. +    rep
  919. +    movsb
  920. +1:
  921. +
  922. +
  923. +
  924. +
  925. +
  926. +
  927. +    movl %esp,%edi        # save stack pointer
  928. +    andl $0xfffffffc,%esp    # align stack to avoid AC fault
  929. +    movl $3,_x86
  930. +    pushfl            # push EFLAGS
  931. +    popl %eax        # get EFLAGS
  932. +    movl %eax,%ecx        # save original EFLAGS
  933. +    xorl $0x40000,%eax    # flip AC bit in EFLAGS
  934. +    pushl %eax        # copy to EFLAGS
  935. +    popfl            # set EFLAGS
  936. +    pushfl            # get new EFLAGS
  937. +    popl %eax        # put it in eax
  938. +    xorl %ecx,%eax        # change in flags
  939. +    andl $0x40000,%eax    # check if AC bit changed
  940. +    je is386
  941. +    movl $4,_x86
  942. +    movl %ecx,%eax
  943. +    xorl $0x200000,%eax    # check ID flag
  944. +    pushl %eax
  945. +    popfl            # if we are on a straight 486DX, SX, or
  946. +    pushfl            # 487SX we can't change it
  947. +    popl %eax
  948. +    xorl %ecx,%eax
  949. +    andl $0x200000,%eax
  950. +    je is486
  951. +isnew:    pushl %ecx        # restore original EFLAGS
  952. +    popfl
  953. +    movl $1, %eax        # Use the CPUID instruction to 
  954. +    .byte 0x0f, 0xa2    # check the processor type
  955. +    andl $0xf00, %eax    # Set _x86 with the family
  956. +    shrl $8, %eax        # returned.    
  957. +    movl %eax, _x86
  958. +    movl %edi,%esp        # restore esp
  959. +    movl %cr0,%eax        # 486+
  960. +    andl $0x80000011,%eax    # Save PG,PE,ET
  961. +    orl $0x50022,%eax    # set AM, WP, NE and MP
  962. +    jmp 2f
  963. +is486:    pushl %ecx        # restore original EFLAGS
  964. +    popfl
  965. +    movl %edi,%esp        # restore esp
  966. +    movl %cr0,%eax        # 486
  967. +    andl $0x80000011,%eax    # Save PG,PE,ET
  968. +    orl $0x50022,%eax    # set AM, WP, NE and MP
  969. +    jmp 2f
  970. +is386:    pushl %ecx        # restore original EFLAGS
  971. +    popfl
  972. +    movl %edi,%esp        # restore esp
  973. +    movl %cr0,%eax        # 386
  974. +    andl $0x80000011,%eax    # Save PG,PE,ET
  975. +    orl $2,%eax        # set MP
  976. +2:    movl %eax,%cr0
  977. +    call check_x87
  978. +    call setup_paging
  979. +    lgdt gdt_descr
  980. +    lidt idt_descr
  981. +    ljmp $(0x10),$1f
  982. +1:    movl $(0x18),%eax    # reload all the segment registers
  983. +    mov %ax,%ds        # after changing gdt.
  984. +    mov %ax,%es
  985. +    mov %ax,%fs
  986. +    mov %ax,%gs
  987. +    lss _stack_start,%esp
  988. +    xorl %eax,%eax
  989. +    lldt %ax
  990. +    pushl %eax        # These are the parameters to main :-)
  991. +    pushl %eax
  992. +    pushl %eax
  993. +    cld            # gcc2 wants the direction flag cleared at all times
  994. +    call _start_kernel
  995. +L6:
  996. +    jmp L6            # main should never return here, but
  997. +                # just in case, we know what happens.
  998. +
  999. +
  1000. +
  1001. +
  1002. +check_x87:
  1003. +    movl $0,_hard_math
  1004. +    clts
  1005. +    fninit
  1006. +    fstsw %ax
  1007. +    cmpb $0,%al
  1008. +    je 1f
  1009. +    movl %cr0,%eax        
  1010. +    xorl $4,%eax        
  1011. +    movl %eax,%cr0
  1012. +    ret
  1013. +.align 2
  1014. +1:    movl $1,_hard_math
  1015. +    .byte 0xDB,0xE4        
  1016. +    ret
  1017. +
  1018. +
  1019. +
  1020. +
  1021. +
  1022. +
  1023. +
  1024. +
  1025. +
  1026. +
  1027. +
  1028. +setup_idt:
  1029. +    lea ignore_int,%edx
  1030. +    movl $(0x10 << 16),%eax
  1031. +    movw %dx,%ax        
  1032. +    movw $0x8E00,%dx    
  1033. +
  1034. +    lea _idt,%edi
  1035. +    mov $256,%ecx
  1036. +rp_sidt:
  1037. +    movl %eax,(%edi)
  1038. +    movl %edx,4(%edi)
  1039. +    addl $8,%edi
  1040. +    dec %ecx
  1041. +    jne rp_sidt
  1042. +    ret
  1043. +
  1044. +
  1045. +
  1046. +
  1047. +
  1048. +
  1049. +
  1050. +
  1051. +
  1052. +
  1053. +
  1054. +
  1055. +
  1056. +.align 2
  1057. +setup_paging:
  1058. +    movl $1024*2,%ecx        
  1059. +    xorl %eax,%eax
  1060. +    movl $_swapper_pg_dir,%edi    
  1061. +    cld;rep;stosl
  1062. +
  1063. +    movl $_pg0+7,_swapper_pg_dir        
  1064. +
  1065. +    movl $_pg0+7,_swapper_pg_dir+3072    
  1066. +    movl $_pg0+4092,%edi
  1067. +    movl $0x03ff007,%eax        
  1068. +    std
  1069. +1:    stosl            
  1070. +    subl $0x1000,%eax
  1071. +    jge 1b
  1072. +    cld
  1073. +    movl $_swapper_pg_dir,%eax
  1074. +    movl %eax,%cr3            
  1075. +    movl %cr0,%eax
  1076. +    orl $0x80000000,%eax
  1077. +    movl %eax,%cr0        
  1078. +    ret            
  1079. +
  1080. +
  1081. +
  1082. +
  1083. +
  1084. +
  1085. +
  1086. +
  1087. +
  1088. +
  1089. +
  1090. +.org 0x1000
  1091. +_swapper_pg_dir:
  1092. +
  1093. +
  1094. +
  1095. +
  1096. +.org 0x2000
  1097. +_pg0:
  1098. +
  1099. +.org 0x3000
  1100. +_empty_bad_page:
  1101. +
  1102. +.org 0x4000
  1103. +_empty_bad_page_table:
  1104. +
  1105. +.org 0x5000
  1106. +_empty_zero_page:
  1107. +
  1108. +.org 0x6000
  1109. +
  1110. +
  1111. +
  1112. +
  1113. +
  1114. +_tmp_floppy_area:
  1115. +    .fill 1024,1,0
  1116. +
  1117. +
  1118. +
  1119. +
  1120. +
  1121. +
  1122. +_floppy_track_buffer:
  1123. +    .fill 512*2*18,1,0
  1124. +
  1125. +
  1126. +int_msg:
  1127. +    .asciz "Unknown interrupt\n"
  1128. +.align 2
  1129. +ignore_int:
  1130. +    cld
  1131. +    pushl %eax
  1132. +    pushl %ecx
  1133. +    pushl %edx
  1134. +    push %ds
  1135. +    push %es
  1136. +    push %fs
  1137. +    movl $(0x18),%eax
  1138. +    mov %ax,%ds
  1139. +    mov %ax,%es
  1140. +    mov %ax,%fs
  1141. +    pushl $int_msg
  1142. +    call _printk
  1143. +    popl %eax
  1144. +    pop %fs
  1145. +    pop %es
  1146. +    pop %ds
  1147. +    popl %edx
  1148. +    popl %ecx
  1149. +    popl %eax
  1150. +    iret
  1151. +
  1152. +
  1153. +
  1154. +
  1155. +.align 4
  1156. +.word 0
  1157. +idt_descr:
  1158. +    .word 256*8-1        # idt contains 256 entries
  1159. +    .long 0xc0000000+_idt
  1160. +
  1161. +.align 4
  1162. +_idt:
  1163. +    .fill 256,8,0        # idt is uninitialized
  1164. +
  1165. +.align 4
  1166. +.word 0
  1167. +gdt_descr:
  1168. +    .word (8+2*128)*8-1
  1169. +    .long 0xc0000000+_gdt
  1170. +
  1171. +
  1172. +
  1173. +
  1174. +
  1175. +.align 4
  1176. +_gdt:
  1177. +    .quad 0x0000000000000000    
  1178. +    .quad 0x0000000000000000    
  1179. +    .quad 0xc0c39a000000ffff    
  1180. +    .quad 0xc0c392000000ffff    
  1181. +    .quad 0x00cbfa000000ffff    
  1182. +    .quad 0x00cbf2000000ffff    
  1183. +    .quad 0x0000000000000000    
  1184. +    .quad 0x0000000000000000    
  1185. +    .fill 2*128,8,0        
  1186. Binary files linux.old/boot/setup and linux/boot/setup differ
  1187. diff -u --new-file --recursive linux.old/boot/setup.s linux/boot/setup.s
  1188. --- linux.old/boot/setup.s    Thu Jan  1 01:00:00 1970
  1189. +++ linux/boot/setup.s    Fri May 20 18:49:28 1994
  1190. @@ -0,0 +1,1102 @@
  1191. +# 1 "boot/setup.S"
  1192. +!
  1193. +!    setup.S        Copyright (C) 1991, 1992 Linus Torvalds
  1194. +!
  1195. +! setup.s is responsible for getting the system data from the BIOS,
  1196. +! and putting them into the appropriate places in system memory.
  1197. +! both setup.s and system has been loaded by the bootblock.
  1198. +!
  1199. +! This code asks the bios for memory/disk/other parameters, and
  1200. +! puts them in a "safe" place: 0x90000-0x901FF, ie where the
  1201. +! boot-block used to be. It is then up to the protected mode
  1202. +! system to read them from there before the area is overwritten
  1203. +! for buffer-blocks.
  1204. +!
  1205. +! Move PS/2 aux init code to psaux.c
  1206. +! (troyer@saifr00.cfsat.Honeywell.COM) 03Oct92
  1207. +!
  1208. +! some changes and additional features by Christoph Niemann, March 1993
  1209. +! (niemann@rubdv15.ETDV.Ruhr-Uni-Bochum.De)
  1210. +!
  1211. +
  1212. +! NOTE! These had better be the same as in bootsect.s!
  1213. +# 1 "/usr/src/v11/linux/include/linux/config.h" 1
  1214. +
  1215. +
  1216. +
  1217. +# 1 "/usr/src/v11/linux/include/linux/autoconf.h" 1
  1218. +
  1219. +
  1220. +
  1221. +
  1222. +
  1223. +
  1224. +
  1225. +
  1226. +
  1227. +
  1228. +
  1229. +
  1230. +
  1231. +
  1232. +
  1233. +
  1234. +
  1235. +
  1236. +
  1237. +
  1238. +
  1239. +
  1240. +
  1241. +
  1242. +
  1243. +
  1244. +
  1245. +
  1246. +
  1247. +
  1248. +
  1249. +
  1250. +
  1251. +
  1252. +
  1253. +
  1254. +
  1255. +
  1256. +
  1257. +
  1258. +
  1259. +
  1260. +
  1261. +
  1262. +
  1263. +
  1264. +
  1265. +
  1266. +
  1267. +
  1268. +
  1269. +
  1270. +
  1271. +
  1272. +
  1273. +
  1274. +
  1275. +
  1276. +
  1277. +
  1278. +
  1279. +
  1280. +
  1281. +
  1282. +
  1283. +
  1284. +
  1285. +
  1286. +
  1287. +
  1288. +
  1289. +
  1290. +
  1291. +
  1292. +
  1293. +
  1294. +
  1295. +
  1296. +
  1297. +
  1298. +
  1299. +
  1300. +
  1301. +
  1302. +
  1303. +
  1304. +
  1305. +
  1306. +
  1307. +
  1308. +
  1309. +
  1310. +
  1311. +
  1312. +
  1313. +
  1314. +
  1315. +
  1316. +
  1317. +
  1318. +
  1319. +
  1320. +
  1321. +
  1322. +
  1323. +
  1324. +
  1325. +
  1326. +
  1327. +
  1328. +
  1329. +
  1330. +
  1331. +
  1332. +
  1333. +
  1334. +
  1335. +
  1336. +
  1337. +
  1338. +
  1339. +
  1340. +
  1341. +
  1342. +
  1343. +# 4 "/usr/src/v11/linux/include/linux/config.h" 2
  1344. +
  1345. +
  1346. +
  1347. +
  1348. +
  1349. +
  1350. +
  1351. +
  1352. +
  1353. +
  1354. +
  1355. +
  1356. +
  1357. +
  1358. +
  1359. +
  1360. +
  1361. +
  1362. +
  1363. +
  1364. +
  1365. +
  1366. +
  1367. +
  1368. +
  1369. +
  1370. +
  1371. +
  1372. +
  1373. +
  1374. +
  1375. +
  1376. +
  1377. +
  1378. +
  1379. +
  1380. +
  1381. +
  1382. +
  1383. +
  1384. +
  1385. +
  1386. +
  1387. +
  1388. +
  1389. +
  1390. +
  1391. +
  1392. +
  1393. +
  1394. +
  1395. +
  1396. +
  1397. +
  1398. +
  1399. +
  1400. +
  1401. +
  1402. +
  1403. +
  1404. +
  1405. +
  1406. +
  1407. +
  1408. +
  1409. +
  1410. +
  1411. +
  1412. +
  1413. +
  1414. +
  1415. +
  1416. +
  1417. +
  1418. +
  1419. +
  1420. +
  1421. +
  1422. +
  1423. +
  1424. +
  1425. +
  1426. +
  1427. +
  1428. +
  1429. +
  1430. +
  1431. +# 22 "boot/setup.S" 2
  1432. +
  1433. +# 1 "/usr/src/v11/linux/include/linux/segment.h" 1
  1434. +
  1435. +
  1436. +
  1437. +
  1438. +
  1439. +
  1440. +
  1441. +
  1442. +
  1443. +
  1444. +# 23 "boot/setup.S" 2
  1445. +
  1446. +
  1447. +
  1448. +
  1449. +
  1450. +
  1451. +INITSEG  = 0x9000    ! we move boot here - out of the way
  1452. +SYSSEG   = 0x1000    ! system loaded at 0x10000 (65536).
  1453. +SETUPSEG = 0x9020    ! this is the current segment
  1454. +
  1455. +.globl begtext, begdata, begbss, endtext, enddata, endbss
  1456. +.text
  1457. +begtext:
  1458. +.data
  1459. +begdata:
  1460. +.bss
  1461. +begbss:
  1462. +.text
  1463. +
  1464. +entry start
  1465. +start:
  1466. +
  1467. +! ok, the read went well so we get current cursor position and save it for
  1468. +! posterity.
  1469. +
  1470. +    mov    ax,#INITSEG    ! this is done in bootsect already, but...
  1471. +    mov    ds,ax
  1472. +
  1473. +! Get memory size (extended mem, kB)
  1474. +
  1475. +    mov    ah,#0x88
  1476. +    int    0x15
  1477. +    mov    [2],ax
  1478. +
  1479. +! set the keyboard repeat rate to the max
  1480. +
  1481. +    mov    ax,#0x0305
  1482. +    xor    bx,bx        ! clear bx
  1483. +    int    0x16
  1484. +
  1485. +! check for EGA/VGA and some config parameters
  1486. +
  1487. +    mov    ah,#0x12
  1488. +    mov    bl,#0x10
  1489. +    int    0x10
  1490. +    mov    [8],ax
  1491. +    mov    [10],bx
  1492. +    mov    [12],cx
  1493. +    mov    ax,#0x5019
  1494. +    cmp    bl,#0x10
  1495. +    je    novga
  1496. +    mov    ax,#0x1a00    ! Added check for EGA/VGA discrimination
  1497. +    int    0x10
  1498. +    mov    bx,ax
  1499. +    mov    ax,#0x5019
  1500. +    cmp    bl,#0x1a    ! 1a means VGA, anything else EGA or lower
  1501. +    jne    novga    
  1502. +    call    chsvga
  1503. +novga:    mov    [14],ax
  1504. +    mov    ah,#0x03    ! read cursor pos
  1505. +    xor    bh,bh        ! clear bh
  1506. +    int    0x10        ! save it in known place, con_init fetches
  1507. +    mov    [0],dx        ! it from 0x90000.
  1508. +    
  1509. +! Get video-card data:
  1510. +    
  1511. +    mov    ah,#0x0f
  1512. +    int    0x10
  1513. +    mov    [4],bx        ! bh = display page
  1514. +    mov    [6],ax        ! al = video mode, ah = window width
  1515. +
  1516. +! Get hd0 data
  1517. +
  1518. +    xor    ax,ax        ! clear ax
  1519. +    mov    ds,ax
  1520. +    lds    si,[4*0x41]
  1521. +    mov    ax,#INITSEG
  1522. +    mov    es,ax
  1523. +    mov    di,#0x0080
  1524. +    mov    cx,#0x10
  1525. +    cld
  1526. +    rep
  1527. +    movsb
  1528. +
  1529. +! Get hd1 data
  1530. +
  1531. +    xor    ax,ax        ! clear ax
  1532. +    mov    ds,ax
  1533. +    lds    si,[4*0x46]
  1534. +    mov    ax,#INITSEG
  1535. +    mov    es,ax
  1536. +    mov    di,#0x0090
  1537. +    mov    cx,#0x10
  1538. +    cld
  1539. +    rep
  1540. +    movsb
  1541. +
  1542. +! Check that there IS a hd1 :-)
  1543. +
  1544. +    mov    ax,#0x01500
  1545. +    mov    dl,#0x81
  1546. +    int    0x13
  1547. +    jc    no_disk1
  1548. +    cmp    ah,#3
  1549. +    je    is_disk1
  1550. +no_disk1:
  1551. +    mov    ax,#INITSEG
  1552. +    mov    es,ax
  1553. +    mov    di,#0x0090
  1554. +    mov    cx,#0x10
  1555. +    xor    ax,ax        ! clear ax
  1556. +    cld
  1557. +    rep
  1558. +    stosb
  1559. +is_disk1:
  1560. +
  1561. +! check for PS/2 pointing device
  1562. +
  1563. +    mov    ax,#INITSEG
  1564. +    mov    ds,ax
  1565. +    mov    [0x1ff],#0    ! default is no pointing device
  1566. +    int    0x11        ! int 0x11: equipment determination
  1567. +    test    al,#0x04    ! check if pointing device installed
  1568. +    jz    no_psmouse
  1569. +    mov    [0x1ff],#0xaa    ! device present
  1570. +no_psmouse:
  1571. +! now we want to move to protected mode ...
  1572. +
  1573. +    cli            ! no interrupts allowed !
  1574. +    mov    al,#0x80    ! disable NMI for the bootup sequence
  1575. +    out    #0x70,al
  1576. +
  1577. +! first we move the system to its rightful place
  1578. +
  1579. +    mov    ax,#0x100    ! start of destination segment
  1580. +    mov    bx,#0x1000    ! start of source segment
  1581. +    cld            ! 'direction'=0, movs moves forward
  1582. +do_move:
  1583. +    mov    es,ax        ! destination segment
  1584. +    add    ax,#0x100
  1585. +    cmp    ax,#0x9000
  1586. +    jz    end_move
  1587. +    mov    ds,bx        ! source segment
  1588. +    add    bx,#0x100
  1589. +    sub    di,di
  1590. +    sub    si,si
  1591. +    mov     cx,#0x800
  1592. +    rep
  1593. +    movsw
  1594. +    jmp    do_move
  1595. +
  1596. +! then we load the segment descriptors
  1597. +
  1598. +end_move:
  1599. +    mov    ax,#SETUPSEG    ! right, forgot this at first. didn't work :-)
  1600. +    mov    ds,ax
  1601. +    lidt    idt_48        ! load idt with 0,0
  1602. +    lgdt    gdt_48        ! load gdt with whatever appropriate
  1603. +
  1604. +! that was painless, now we enable A20
  1605. +
  1606. +    call    empty_8042
  1607. +    mov    al,#0xD1        ! command write
  1608. +    out    #0x64,al
  1609. +    call    empty_8042
  1610. +    mov    al,#0xDF        ! A20 on
  1611. +    out    #0x60,al
  1612. +    call    empty_8042
  1613. +
  1614. +! make sure any possible coprocessor is properly reset..
  1615. +
  1616. +    xor    ax,ax
  1617. +    out    #0xf0,al
  1618. +    call    delay
  1619. +    out    #0xf1,al
  1620. +    call    delay
  1621. +
  1622. +! well, that went ok, I hope. Now we have to reprogram the interrupts :-(
  1623. +! we put them right after the intel-reserved hardware interrupts, at
  1624. +! int 0x20-0x2F. There they won't mess up anything. Sadly IBM really
  1625. +! messed this up with the original PC, and they haven't been able to
  1626. +! rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f,
  1627. +! which is used for the internal hardware interrupts as well. We just
  1628. +! have to reprogram the 8259's, and it isn't fun.
  1629. +
  1630. +    mov    al,#0x11        ! initialization sequence
  1631. +    out    #0x20,al        ! send it to 8259A-1
  1632. +    call    delay
  1633. +    out    #0xA0,al        ! and to 8259A-2
  1634. +    call    delay
  1635. +    mov    al,#0x20        ! start of hardware int's (0x20)
  1636. +    out    #0x21,al
  1637. +    call    delay
  1638. +    mov    al,#0x28        ! start of hardware int's 2 (0x28)
  1639. +    out    #0xA1,al
  1640. +    call    delay
  1641. +    mov    al,#0x04        ! 8259-1 is master
  1642. +    out    #0x21,al
  1643. +    call    delay
  1644. +    mov    al,#0x02        ! 8259-2 is slave
  1645. +    out    #0xA1,al
  1646. +    call    delay
  1647. +    mov    al,#0x01        ! 8086 mode for both
  1648. +    out    #0x21,al
  1649. +    call    delay
  1650. +    out    #0xA1,al
  1651. +    call    delay
  1652. +    mov    al,#0xFF        ! mask off all interrupts for now
  1653. +    out    #0xA1,al
  1654. +    call    delay
  1655. +    mov    al,#0xFB        ! mask all irq's but irq2 which
  1656. +    out    #0x21,al        ! is cascaded
  1657. +
  1658. +! well, that certainly wasn't fun :-(. Hopefully it works, and we don't
  1659. +! need no steenking BIOS anyway (except for the initial loading :-).
  1660. +! The BIOS-routine wants lots of unnecessary data, and it's less
  1661. +! "interesting" anyway. This is how REAL programmers do it.
  1662. +!
  1663. +! Well, now's the time to actually move into protected mode. To make
  1664. +! things as simple as possible, we do no register set-up or anything,
  1665. +! we let the gnu-compiled 32-bit programs do that. We just jump to
  1666. +! absolute address 0x00000, in 32-bit protected mode.
  1667. +!
  1668. +! Note that the short jump isn't strictly needed, althought there are
  1669. +! reasons why it might be a good idea. It won't hurt in any case.
  1670. +!
  1671. +    mov    ax,#0x0001    ! protected mode (PE) bit
  1672. +    lmsw    ax        ! This is it!
  1673. +    jmp    flush_instr
  1674. +flush_instr:
  1675. +    jmpi    0x1000,0x10    ! jmp offset 1000 of segment 0x10 (cs)
  1676. +
  1677. +! This routine checks that the keyboard command queue is empty
  1678. +! (after emptying the output buffers)
  1679. +!
  1680. +! No timeout is used - if this hangs there is something wrong with
  1681. +! the machine, and we probably couldn't proceed anyway.
  1682. +empty_8042:
  1683. +    call    delay
  1684. +    in    al,#0x64    ! 8042 status port
  1685. +    test    al,#1        ! output buffer?
  1686. +    jz    no_output
  1687. +    call    delay
  1688. +    in    al,#0x60    ! read it
  1689. +    jmp    empty_8042
  1690. +no_output:
  1691. +    test    al,#2        ! is input buffer full?
  1692. +    jnz    empty_8042    ! yes - loop
  1693. +    ret
  1694. +!
  1695. +! Read a key and return the (US-)ascii code in al, scan code in ah
  1696. +!
  1697. +getkey:
  1698. +    xor    ah,ah
  1699. +    int    0x16
  1700. +    ret
  1701. +
  1702. +!
  1703. +! Read a key with a timeout of 30 seconds. The cmos clock is used to get
  1704. +! the time.
  1705. +!
  1706. +getkt:
  1707. +    call    gettime
  1708. +    add    al,#30        ! wait 30 seconds
  1709. +    cmp    al,#60
  1710. +    jl    lminute
  1711. +    sub    al,#60
  1712. +lminute:
  1713. +    mov    cl,al
  1714. +again:    mov    ah,#0x01
  1715. +    int    0x16
  1716. +    jnz    getkey        ! key pressed, so get it
  1717. +    call    gettime
  1718. +    cmp    al,cl
  1719. +    jne    again
  1720. +    mov    al,#0x20    ! timeout, return default char `space'
  1721. +    ret
  1722. +
  1723. +!
  1724. +! Flush the keyboard buffer
  1725. +!
  1726. +flush:    mov    ah,#0x01
  1727. +    int    0x16
  1728. +    jz    empty
  1729. +    xor    ah,ah
  1730. +    int    0x16
  1731. +    jmp    flush
  1732. +empty:    ret
  1733. +
  1734. +!
  1735. +! Read the cmos clock. Return the seconds in al
  1736. +!
  1737. +gettime:
  1738. +    push    cx
  1739. +    mov    ah,#0x02
  1740. +    int    0x1a
  1741. +    mov    al,dh            ! dh contains the seconds
  1742. +    and    al,#0x0f
  1743. +    mov    ah,dh
  1744. +    mov    cl,#0x04
  1745. +    shr    ah,cl
  1746. +    aad
  1747. +    pop    cx
  1748. +    ret
  1749. +
  1750. +!
  1751. +! Delay is needed after doing i/o
  1752. +!
  1753. +delay:
  1754. +    .word    0x00eb            ! jmp $+2
  1755. +    ret
  1756. +
  1757. +! Routine trying to recognize type of SVGA-board present (if any)
  1758. +! and if it recognize one gives the choices of resolution it offers.
  1759. +! If one is found the resolution chosen is given by al,ah (rows,cols).
  1760. +
  1761. +chsvga:    cld
  1762. +    push    ds
  1763. +    push    cs
  1764. +    mov    ax,[0x01fa]
  1765. +    pop    ds
  1766. +    mov    modesave,ax
  1767. +    mov     ax,#0xc000
  1768. +    mov    es,ax
  1769. +    mov    ax,modesave
  1770. +    cmp    ax,#0xffff        
  1771. +    je    defvga
  1772. +    cmp    ax,#0xfffe        
  1773. +    je    vga50
  1774. +    cmp    ax,#    0xfffd        
  1775. +    jne    svga
  1776. +    lea    si,msg1
  1777. +    call    prtstr
  1778. +    call    flush
  1779. +nokey:    call    getkt
  1780. +    cmp    al,#0x0d        ! enter ?
  1781. +    je    svga            ! yes - svga selection
  1782. +    cmp    al,#0x20        ! space ?
  1783. +    je    defvga            ! no - repeat
  1784. +    call     beep
  1785. +    jmp    nokey
  1786. +defvga:    mov    ax,#0x5019
  1787. +    pop    ds
  1788. +    ret
  1789. +
  1790. +vga50:
  1791. +    mov    ax,#0x1112
  1792. +    xor    bl,bl
  1793. +    int    0x10        ! use 8x8 font set (50 lines on VGA)
  1794. +    mov    ax,#0x1200
  1795. +    mov    bl,#0x20
  1796. +    int    0x10        ! use alternate print screen
  1797. +    mov    ax,#0x1201
  1798. +    mov    bl,#0x34
  1799. +    int    0x10        ! turn off cursor emulation
  1800. +    mov    ah,#0x01
  1801. +    mov    cx,#0x0607
  1802. +    int    0x10        ! turn on cursor (scan lines 6 to 7)
  1803. +    pop    ds
  1804. +    mov    ax,#0x5032    ! return 80x50
  1805. +    ret
  1806. +
  1807. +vga28:
  1808. +    pop    ax        ! clean the stack
  1809. +    mov    ax,#0x1111
  1810. +    xor    bl,bl
  1811. +    int    0x10        ! use 9x14 fontset (28 lines on VGA)
  1812. +    mov    ah, #0x01
  1813. +    mov    cx,#0x0b0c
  1814. +    int    0x10        ! turn on cursor (scan lines 11 to 12)
  1815. +    pop    ds
  1816. +    mov    ax,#0x501c    ! return 80x28
  1817. +    ret
  1818. +
  1819. +svga:   cld
  1820. +        lea     si,id9GXE    ! Check for the #9GXE (jyanowit@orixa.mtholyoke.edu,thanks dlm40629@uxa.cso.uiuc.edu)
  1821. +        mov     di,#0x49    ! id string is at c000:049
  1822. +        mov     cx,#0x11    ! length of "Graphics Power By"
  1823. +        repe
  1824. +        cmpsb
  1825. +        jne     of1280
  1826. +is9GXE:    lea     si,dsc9GXE    ! table of descriptions of video modes for BIOS
  1827. +    lea    di,mo9GXE    ! table of sizes of video modes for my BIOS
  1828. +    br    selmod        ! go ask for video mode
  1829. +of1280:    cld    
  1830. +    lea    si,idf1280    ! Check for Orchid F1280 (dingbat@diku.dk)
  1831. +    mov    di,#0x10a    ! id string is at c000:010a
  1832. +    mov    cx,#0x21    ! length
  1833. +    repe
  1834. +    cmpsb
  1835. +    jne    nf1280    
  1836. +isVRAM:    lea    si,dscf1280
  1837. +    lea    di,mof1280
  1838. +    br    selmod
  1839. +nf1280:    lea    si,idVRAM
  1840. +    mov    di,#0x10a
  1841. +    mov    cx,#0x0c
  1842. +    repe
  1843. +    cmpsb
  1844. +    je    isVRAM
  1845. +    cld
  1846. +    lea     si,idati        ! Check ATI 'clues'
  1847. +    mov    di,#0x31
  1848. +    mov     cx,#0x09
  1849. +    repe
  1850. +    cmpsb
  1851. +    jne    noati
  1852. +    lea    si,dscati
  1853. +    lea    di,moati
  1854. +    br    selmod
  1855. +noati:    mov    ax,#0x200f        ! Check Ahead 'clues'
  1856. +    mov    dx,#0x3ce
  1857. +    out    dx,ax
  1858. +    inc    dx
  1859. +    in    al,dx
  1860. +    cmp    al,#0x20
  1861. +    je    isahed
  1862. +    cmp    al,#0x21
  1863. +    jne    noahed
  1864. +isahed:    lea    si,dscahead
  1865. +    lea    di,moahead
  1866. +    br    selmod
  1867. +noahed:    mov    dx,#0x3c3        ! Check Chips & Tech. 'clues'
  1868. +    in    al,dx
  1869. +    or    al,#0x10
  1870. +    out    dx,al
  1871. +    mov    dx,#0x104        
  1872. +    in    al,dx
  1873. +    mov    bl,al
  1874. +    mov    dx,#0x3c3
  1875. +    in    al,dx
  1876. +    and    al,#0xef
  1877. +    out    dx,al
  1878. +    cmp    bl,[idcandt]
  1879. +    jne    nocant
  1880. +    lea    si,dsccandt
  1881. +    lea    di,mocandt
  1882. +    br    selmod
  1883. +nocant:    mov    dx,#0x3d4        ! Check Cirrus 'clues'
  1884. +    mov    al,#0x0c
  1885. +    out    dx,al
  1886. +    inc    dx
  1887. +    in    al,dx
  1888. +    mov    bl,al
  1889. +    xor    al,al
  1890. +    out    dx,al
  1891. +    dec    dx
  1892. +    mov    al,#0x1f
  1893. +    out    dx,al
  1894. +    inc    dx
  1895. +    in    al,dx
  1896. +    mov    bh,al
  1897. +    xor    ah,ah
  1898. +    shl    al,#4
  1899. +    mov    cx,ax
  1900. +    mov    al,bh
  1901. +    shr    al,#4
  1902. +    add    cx,ax
  1903. +    shl    cx,#8
  1904. +    add    cx,#6
  1905. +    mov    ax,cx
  1906. +    mov    dx,#0x3c4
  1907. +    out    dx,ax
  1908. +    inc    dx
  1909. +    in    al,dx
  1910. +    and    al,al
  1911. +    jnz    nocirr
  1912. +    mov    al,bh
  1913. +    out    dx,al
  1914. +    in    al,dx
  1915. +    cmp    al,#0x01
  1916. +    jne    nocirr
  1917. +    call    rst3d4    
  1918. +    lea    si,dsccirrus
  1919. +    lea    di,mocirrus
  1920. +    br    selmod
  1921. +rst3d4:    mov    dx,#0x3d4
  1922. +    mov    al,bl
  1923. +    xor    ah,ah
  1924. +    shl    ax,#8
  1925. +    add    ax,#0x0c
  1926. +    out    dx,ax
  1927. +    ret    
  1928. +nocirr:    call    rst3d4            ! Check Everex 'clues'
  1929. +    mov    ax,#0x7000
  1930. +    xor    bx,bx
  1931. +    int    0x10
  1932. +    cmp    al,#0x70
  1933. +    jne    noevrx
  1934. +    shr    dx,#4
  1935. +    cmp    dx,#0x678
  1936. +    je    istrid
  1937. +    cmp    dx,#0x236
  1938. +    je    istrid
  1939. +    lea    si,dsceverex
  1940. +    lea    di,moeverex
  1941. +    br    selmod
  1942. +istrid:    lea    cx,ev2tri
  1943. +    jmp    cx
  1944. +noevrx:    lea    si,idgenoa        ! Check Genoa 'clues'
  1945. +    xor     ax,ax
  1946. +    seg es
  1947. +    mov    al,[0x37]
  1948. +    mov    di,ax
  1949. +    mov    cx,#0x04
  1950. +    dec    si
  1951. +    dec    di
  1952. +l1:    inc    si
  1953. +    inc    di
  1954. +    mov    al,(si)
  1955. +    test    al,al
  1956. +    jz    l2
  1957. +    seg es
  1958. +    cmp    al,(di)
  1959. +l2:    loope     l1
  1960. +    cmp    cx,#0x00
  1961. +    jne    nogen
  1962. +    lea    si,dscgenoa
  1963. +    lea    di,mogenoa
  1964. +    br    selmod
  1965. +nogen:    cld
  1966. +    lea    si,idoakvga
  1967. +    mov    di,#0x08
  1968. +    mov    cx,#0x08
  1969. +    repe
  1970. +    cmpsb
  1971. +    jne    nooak
  1972. +    lea    si,dscoakvga
  1973. +    lea    di,mooakvga
  1974. +    br    selmod
  1975. +nooak:    cld
  1976. +    lea    si,idparadise        ! Check Paradise 'clues'
  1977. +    mov    di,#0x7d
  1978. +    mov    cx,#0x04
  1979. +    repe
  1980. +    cmpsb
  1981. +    jne    nopara
  1982. +    lea    si,dscparadise
  1983. +    lea    di,moparadise
  1984. +    br    selmod
  1985. +nopara:    mov    dx,#0x3c4        ! Check Trident 'clues'
  1986. +    mov    al,#0x0e
  1987. +    out    dx,al
  1988. +    inc    dx
  1989. +    in    al,dx
  1990. +    xchg    ah,al
  1991. +    xor    al,al
  1992. +    out    dx,al
  1993. +    in    al,dx
  1994. +    xchg    al,ah
  1995. +    mov    bl,al        ! Strange thing ... in the book this wasn't
  1996. +    and    bl,#0x02    ! necessary but it worked on my card which
  1997. +    jz    setb2        ! is a trident. Without it the screen goes
  1998. +    and    al,#0xfd    ! blurred ...
  1999. +    jmp    clrb2        !
  2000. +setb2:    or    al,#0x02    !
  2001. +clrb2:    out    dx,al
  2002. +    and    ah,#0x0f
  2003. +    cmp    ah,#0x02
  2004. +    jne    notrid
  2005. +ev2tri:    lea    si,dsctrident
  2006. +    lea    di,motrident
  2007. +    jmp    selmod
  2008. +notrid:    mov    dx,#0x3cd        ! Check Tseng 'clues'
  2009. +    in    al,dx            ! Could things be this simple ! :-)
  2010. +    mov    bl,al
  2011. +    mov    al,#0x55
  2012. +    out    dx,al
  2013. +    in    al,dx
  2014. +    mov    ah,al
  2015. +    mov    al,bl
  2016. +    out    dx,al
  2017. +    cmp    ah,#0x55
  2018. +     jne    notsen
  2019. +    lea    si,dsctseng
  2020. +    lea    di,motseng
  2021. +    jmp    selmod
  2022. +notsen:    mov    dx,#0x3cc        ! Check Video7 'clues'
  2023. +    in    al,dx
  2024. +    mov    dx,#0x3b4
  2025. +    and    al,#0x01
  2026. +    jz    even7
  2027. +    mov    dx,#0x3d4
  2028. +even7:    mov    al,#0x0c
  2029. +    out    dx,al
  2030. +    inc    dx
  2031. +    in    al,dx
  2032. +    mov    bl,al
  2033. +    mov    al,#0x55
  2034. +    out    dx,al
  2035. +    in    al,dx
  2036. +    dec    dx
  2037. +    mov    al,#0x1f
  2038. +    out    dx,al
  2039. +    inc    dx
  2040. +    in    al,dx
  2041. +    mov    bh,al
  2042. +    dec    dx
  2043. +    mov    al,#0x0c
  2044. +    out    dx,al
  2045. +    inc    dx
  2046. +    mov    al,bl
  2047. +    out    dx,al
  2048. +    mov    al,#0x55
  2049. +    xor    al,#0xea
  2050. +    cmp    al,bh
  2051. +    jne    novid7
  2052. +    lea    si,dscvideo7
  2053. +    lea    di,movideo7
  2054. +    jmp    selmod
  2055. +novid7:    lea    si,dsunknown
  2056. +    lea    di,mounknown
  2057. +selmod:    xor    cx,cx
  2058. +    mov    cl,(di)
  2059. +    mov    ax,modesave
  2060. +    cmp    ax,#    0xfffd        
  2061. +    je    askmod
  2062. +    cmp    ax,#0xffff        
  2063. +    je    askmod
  2064. +    cmp    al,cl
  2065. +    jl    gotmode
  2066. +    push    si
  2067. +    lea    si,msg4
  2068. +    call    prtstr
  2069. +    pop    si
  2070. +askmod:    push    si
  2071. +    lea    si,msg2
  2072. +    call    prtstr
  2073. +    pop    si
  2074. +    push    si
  2075. +    push    cx
  2076. +tbl:    pop    bx
  2077. +    push    bx
  2078. +    mov    al,bl
  2079. +    sub    al,cl
  2080. +    call    modepr
  2081. +    lodsw
  2082. +    xchg    al,ah
  2083. +    call    dprnt
  2084. +    xchg    ah,al
  2085. +    push    ax
  2086. +    mov    al,#0x78
  2087. +    call    prnt1
  2088. +    pop    ax
  2089. +    call    dprnt
  2090. +    push    si
  2091. +    lea    si,crlf        ! print CR+LF
  2092. +    call    prtstr
  2093. +    pop    si
  2094. +    loop    tbl
  2095. +    pop    cx
  2096. +    lea    si,msg3
  2097. +    call    prtstr
  2098. +    pop    si
  2099. +    add    cl,#0x30
  2100. +    jmp    nonum
  2101. +nonumb:    call    beep
  2102. +nonum:    call    getkey
  2103. +    cmp    al,#0x30    ! ascii `0'
  2104. +    jb    nonumb
  2105. +    cmp    al,#0x3a    ! ascii `9'
  2106. +    jbe    number
  2107. +    cmp    al,#0x61    ! ascii `a'
  2108. +    jb    nonumb
  2109. +    cmp    al,#0x7a    ! ascii `z'
  2110. +    ja    nonumb
  2111. +    sub    al,#0x27
  2112. +    cmp    al,cl
  2113. +    jae    nonumb
  2114. +    sub    al,#0x30
  2115. +    jmp    gotmode
  2116. +number: cmp    al,cl
  2117. +    jae    nonumb
  2118. +    sub    al,#0x30
  2119. +gotmode:    xor    ah,ah
  2120. +    or    al,al
  2121. +    beq    vga50
  2122. +    push    ax
  2123. +    dec    ax
  2124. +    beq    vga28
  2125. +    add    di,ax
  2126. +    mov    al,(di)
  2127. +    int     0x10
  2128. +    pop    ax
  2129. +    shl    ax,#1
  2130. +    add    si,ax
  2131. +    lodsw
  2132. +    pop    ds
  2133. +    ret
  2134. +
  2135. +! Routine to print asciiz-string at DS:SI
  2136. +
  2137. +prtstr:    lodsb
  2138. +    and    al,al
  2139. +    jz    fin
  2140. +    call    prnt1
  2141. +    jmp    prtstr
  2142. +fin:    ret
  2143. +
  2144. +! Routine to print a decimal value on screen, the value to be
  2145. +! printed is put in al (i.e 0-255). 
  2146. +
  2147. +dprnt:    push    ax
  2148. +    push    cx
  2149. +    xor    ah,ah        ! Clear ah
  2150. +    mov    cl,#0x0a
  2151. +    idiv    cl
  2152. +    cmp    al,#0x09
  2153. +    jbe    lt100
  2154. +    call    dprnt
  2155. +    jmp    skip10
  2156. +lt100:    add    al,#0x30
  2157. +    call    prnt1
  2158. +skip10:    mov    al,ah
  2159. +    add    al,#0x30
  2160. +    call    prnt1    
  2161. +    pop    cx
  2162. +    pop    ax
  2163. +    ret
  2164. +
  2165. +!
  2166. +! Routine to print the mode number key on screen. Mode numbers
  2167. +! 0-9 print the ascii values `0' to '9', 10-35 are represented by
  2168. +! the letters `a' to `z'. This routine prints some spaces around the
  2169. +! mode no.
  2170. +!
  2171. +
  2172. +modepr:    push    ax
  2173. +    cmp    al,#0x0a
  2174. +    jb    digit        ! Here is no check for number > 35
  2175. +    add    al,#0x27
  2176. +digit:    add    al,#0x30
  2177. +    mov    modenr, al
  2178. +    push     si
  2179. +    lea    si, modestring
  2180. +    call    prtstr
  2181. +    pop    si
  2182. +    pop    ax
  2183. +    ret
  2184. +
  2185. +! Part of above routine, this one just prints ascii al
  2186. +
  2187. +prnt1:    push    ax
  2188. +    push    cx
  2189. +    xor    bh,bh
  2190. +    mov    cx,#0x01
  2191. +    mov    ah,#0x0e
  2192. +    int    0x10
  2193. +    pop    cx
  2194. +    pop    ax
  2195. +    ret
  2196. +
  2197. +beep:    mov    al,#0x07
  2198. +    jmp    prnt1
  2199. +    
  2200. +gdt:
  2201. +    .word    0,0,0,0        ! dummy
  2202. +
  2203. +    .word    0,0,0,0        ! unused
  2204. +
  2205. +    .word    0x07FF        ! 8Mb - limit=2047 (2048*4096=8Mb)
  2206. +    .word    0x0000        ! base address=0
  2207. +    .word    0x9A00        ! code read/exec
  2208. +    .word    0x00C0        ! granularity=4096, 386
  2209. +
  2210. +    .word    0x07FF        ! 8Mb - limit=2047 (2048*4096=8Mb)
  2211. +    .word    0x0000        ! base address=0
  2212. +    .word    0x9200        ! data read/write
  2213. +    .word    0x00C0        ! granularity=4096, 386
  2214. +
  2215. +idt_48:
  2216. +    .word    0            ! idt limit=0
  2217. +    .word    0,0            ! idt base=0L
  2218. +
  2219. +gdt_48:
  2220. +    .word    0x800        ! gdt limit=2048, 256 GDT entries
  2221. +    .word    512+gdt,0x9    ! gdt base = 0X9xxxx
  2222. +
  2223. +msg1:        .ascii    "Press <RETURN> to see SVGA-modes available, <SPACE> to continue or wait 30 secs."
  2224. +        db    0x0d, 0x0a, 0x0a, 0x00
  2225. +msg2:        .ascii    "Mode:  COLSxROWS:"
  2226. +        db    0x0d, 0x0a, 0x0a, 0x00
  2227. +msg3:        db    0x0d, 0x0a
  2228. +        .ascii    "Choose mode by pressing the corresponding number or letter."
  2229. +crlf:        db    0x0d, 0x0a, 0x00
  2230. +msg4:        .ascii    "You passed an undefined mode number to setup. Please choose a new mode."
  2231. +        db    0x0d, 0x0a, 0x0a, 0x07, 0x00
  2232. +modestring:    .ascii    "   "
  2233. +modenr:        db    0x00    ! mode number
  2234. +        .ascii    ":    "
  2235. +        db    0x00
  2236. +        
  2237. +idati:        .ascii    "761295520"
  2238. +idcandt:    .byte    0xa5
  2239. +idgenoa:    .byte    0x77, 0x00, 0x99, 0x66
  2240. +idparadise:    .ascii    "VGA="
  2241. +idoakvga:    .ascii  "OAK VGA "
  2242. +idf1280:    .ascii    "Orchid Technology Fahrenheit 1280"
  2243. +id9GXE:        .ascii  "Graphics Power By"
  2244. +idVRAM:        .ascii    "Stealth VRAM"
  2245. +
  2246. +! Manufacturer:      Numofmodes+2:    Mode:
  2247. +! Number of modes is the number of chip-specific svga modes plus the extended
  2248. +! modes available on any vga (currently 2)
  2249. +
  2250. +moati:        .byte    0x04,    0x23, 0x33 
  2251. +moahead:    .byte    0x07,    0x22, 0x23, 0x24, 0x2f, 0x34
  2252. +mocandt:    .byte    0x04,    0x60, 0x61
  2253. +mocirrus:    .byte    0x06,    0x1f, 0x20, 0x22, 0x31
  2254. +moeverex:    .byte    0x0c,    0x03, 0x04, 0x07, 0x08, 0x0a, 0x0b, 0x16, 0x18, 0x21, 0x40
  2255. +mogenoa:    .byte    0x0c,    0x58, 0x5a, 0x60, 0x61, 0x62, 0x63, 0x64, 0x72, 0x74, 0x78
  2256. +moparadise:    .byte    0x04,    0x55, 0x54
  2257. +motrident:    .byte    0x09,    0x50, 0x51, 0x52, 0x57, 0x58, 0x59, 0x5a
  2258. +motseng:    .byte    0x07,    0x26, 0x2a, 0x23, 0x24, 0x22
  2259. +movideo7:    .byte    0x08,    0x40, 0x43, 0x44, 0x41, 0x42, 0x45
  2260. +mooakvga:    .byte   0x08,   0x00, 0x07, 0x4e, 0x4f, 0x50, 0x51
  2261. +mo9GXE:        .byte    0x04,    0x54, 0x55
  2262. +mof1280:    .byte    0x04,    0x54, 0x55
  2263. +mounknown:    .byte    0x02
  2264. +
  2265. +!            msb = Cols lsb = Rows:
  2266. +! The first two modes are standard vga modes available on any vga.
  2267. +! mode 0 is 80x50 and mode 1 is 80x28
  2268. +
  2269. +dscati:        .word    0x5032, 0x501c, 0x8419, 0x842c
  2270. +dscahead:    .word    0x5032, 0x501c, 0x842c, 0x8419, 0x841c, 0xa032, 0x5042
  2271. +dsccandt:    .word    0x5032, 0x501c, 0x8419, 0x8432
  2272. +dsccirrus:    .word    0x5032, 0x501c, 0x8419, 0x842c, 0x841e, 0x6425
  2273. +dsceverex:    .word    0x5032, 0x501c, 0x5022, 0x503c, 0x642b, 0x644b, 0x8419, 0x842c, 0x501e, 0x641b, 0xa040, 0x841e
  2274. +dscgenoa:    .word    0x5032, 0x501c, 0x5020, 0x642a, 0x8419, 0x841d, 0x8420, 0x842c, 0x843c, 0x503c, 0x5042, 0x644b
  2275. +dscparadise:    .word    0x5032, 0x501c, 0x8419, 0x842b
  2276. +dsctrident:    .word     0x5032, 0x501c, 0x501e, 0x502b, 0x503c, 0x8419, 0x841e, 0x842b, 0x843c
  2277. +dsctseng:    .word    0x5032, 0x501c, 0x503c, 0x6428, 0x8419, 0x841c, 0x842c
  2278. +dscvideo7:    .word    0x5032, 0x501c, 0x502b, 0x503c, 0x643c, 0x8419, 0x842c, 0x841c
  2279. +dscoakvga:    .word   0x5032, 0x501c, 0x2819, 0x5019, 0x503c, 0x843c, 0x8419, 0x842b
  2280. +dscf1280:    .word    0x5032, 0x501c, 0x842b, 0x8419
  2281. +dsc9GXE:    .word    0x5032, 0x501c, 0x842b, 0x8419
  2282. +dsunknown:    .word    0x5032, 0x501c
  2283. +modesave:    .word    0xffff        
  2284. +
  2285. +    
  2286. +.text
  2287. +endtext:
  2288. +.data
  2289. +enddata:
  2290. +.bss
  2291. +endbss:
  2292. diff -u --new-file --recursive linux.old/config.in linux/config.in
  2293. --- linux.old/config.in    Fri May 20 18:47:29 1994
  2294. +++ linux/config.in    Fri May 20 18:51:01 1994
  2295. @@ -6,34 +6,34 @@
  2296.  comment 'General setup'
  2297.  
  2298.  bool 'Kernel math emulation' CONFIG_MATH_EMULATION y
  2299. -bool 'Normal harddisk support' CONFIG_BLK_DEV_HD y
  2300. +bool 'Normal harddisk support' CONFIG_BLK_DEV_HD n
  2301.  bool 'XT harddisk support' CONFIG_BLK_DEV_XD n
  2302. -bool 'TCP/IP networking' CONFIG_INET y
  2303. +bool 'Networking' CONFIG_NET y
  2304.  bool 'Limit memory to low 16MB' CONFIG_MAX_16M n
  2305.  bool 'System V IPC' CONFIG_SYSVIPC y
  2306. -bool 'Use -m486 flag for 486-specific optimizations' CONFIG_M486 y
  2307. -
  2308. -if [ "$CONFIG_INET" = "y" ]; then
  2309. +bool 'Use -m486 flag for 486-specific optimizations' CONFIG_M486 n
  2310.  
  2311. +if [ "$CONFIG_NET" = "y" ]; then
  2312.  comment 'Networking options'
  2313. +bool 'TCP/IP networking' CONFIG_INET y
  2314. +if [ "$CONFIG_INET" "=" "y" ]; then
  2315.  comment '(it is safe to leave these untouched)'
  2316. -
  2317. -comment 'IP (required for now) y'
  2318. -bool 'Reverse ARP' CONFIG_INET_RARP y
  2319. +bool 'Reverse ARP' CONFIG_INET_RARP n
  2320.  bool 'Assume subnets are local' CONFIG_INET_SNARL y
  2321.  bool 'Disable NAGLE algorithm (normally enabled)' CONFIG_TCP_NAGLE_OFF n
  2322. -#bool 'Novell IPX protocol' CONFIG_IPX n
  2323. +fi
  2324. +bool 'The IPX protocol' CONFIG_IPX y
  2325.  #bool 'Amateur Radio AX.25 Level 2' CONFIG_AX25 n
  2326.  fi
  2327.  
  2328.  comment 'Program binary formats'
  2329.  
  2330. -bool 'Elf executables' CONFIG_BINFMT_ELF y
  2331. -bool 'COFF executables' CONFIG_BINFMT_COFF y
  2332. +bool 'Elf executables' CONFIG_BINFMT_ELF n
  2333. +bool 'COFF executables' CONFIG_BINFMT_COFF n
  2334.  
  2335.  comment 'SCSI support'
  2336.  
  2337. -bool 'SCSI support?' CONFIG_SCSI n
  2338. +bool 'SCSI support?' CONFIG_SCSI y
  2339.  
  2340.  if [ "$CONFIG_SCSI" = "n" ]; then
  2341.  
  2342. @@ -62,23 +62,27 @@
  2343.  bool '7000FASST SCSI support' CONFIG_SCSI_7000FASST n
  2344.  fi
  2345.  
  2346. +
  2347. +if [ "$CONFIG_NET" = "y" ]; then
  2348. +
  2349.  comment 'Network device support'
  2350.  
  2351. -bool 'Network device support?' CONFIG_ETHERCARDS y
  2352. -if [ "$CONFIG_ETHERCARDS" = "n" ]; then
  2353. +bool 'Network device support?' CONFIG_NETDEVICES y
  2354. +if [ "$CONFIG_NETDEVICES" = "n" ]; then
  2355.  
  2356.  comment 'Skipping ethercard configuration options...'
  2357.  
  2358.  else
  2359. -bool 'SLIP (serial line) support' CONFIG_SLIP n
  2360. +bool 'SLIP (serial line) support' CONFIG_SLIP y
  2361.  if [ "$CONFIG_SLIP" = "y" ]; then
  2362.    bool ' CSLIP compressed headers' SL_COMPRESSED y
  2363.  #  bool ' SLIP debugging on' SL_DUMP y
  2364.  fi
  2365.  #bool 'PPP (point-to-point) support' CONFIG_PPP n
  2366. +bool 'Load balancing support (very experimental)' CONFIG_SLAVE_BALANCING y
  2367.  bool 'PLIP (parallel port) support' CONFIG_PLIP n
  2368.  bool 'NE2000/NE1000 support' CONFIG_NE2000 n
  2369. -bool 'WD80*3 support' CONFIG_WD80x3 y
  2370. +bool 'WD80*3 support' CONFIG_WD80x3 n
  2371.  bool 'SMC Ultra support' CONFIG_ULTRA n
  2372.  bool '3c501 support' CONFIG_EL1 n
  2373.  bool '3c503 support' CONFIG_EL2 n
  2374. @@ -86,7 +90,7 @@
  2375.  #bool '3c507 support' CONFIG_EL16 n
  2376.  bool '3c509/3c579 support' CONFIG_EL3 n
  2377.  bool 'HP PCLAN support' CONFIG_HPLAN n
  2378. -bool 'AT1500 and NE2100 (LANCE and PCnet-ISA) support' CONFIG_LANCE n
  2379. +bool 'AT1500 and NE2100 (LANCE and PCnet-ISA) support' CONFIG_LANCE y
  2380.  bool 'AT1700 support' CONFIG_AT1700 n
  2381.  #bool 'Zenith Z-Note support' CONFIG_ZNET n
  2382.  #bool 'EtherExpress support' CONFIG_EEXPRESS n
  2383. @@ -98,6 +102,7 @@
  2384.  bool 'D-Link DE600 pocket adaptor support' CONFIG_DE600 n
  2385.  bool 'AT-LAN-TEC/RealTek pocket adaptor support' CONFIG_ATP n
  2386.  fi
  2387. +fi
  2388.  
  2389.  comment 'CD-ROM drivers'
  2390.  
  2391. @@ -113,7 +118,9 @@
  2392.  bool 'xiafs filesystem support' CONFIG_XIA_FS n
  2393.  bool 'msdos fs support' CONFIG_MSDOS_FS y
  2394.  bool '/proc filesystem support' CONFIG_PROC_FS y
  2395. +if [ "$CONFIG_INET" = "y" ]; then
  2396.  bool 'NFS filesystem support' CONFIG_NFS_FS y
  2397. +fi
  2398.  bool 'ISO9660 cdrom filesystem support' CONFIG_ISO9660_FS n
  2399.  bool 'OS/2 HPFS filesystem support (read only)' CONFIG_HPFS_FS n
  2400.  bool 'System V and Coherent filesystem support' CONFIG_SYSV_FS n
  2401. @@ -122,13 +129,13 @@
  2402.  
  2403.  bool 'Parallel printer support' CONFIG_PRINTER n
  2404.  bool 'Logitech busmouse support' CONFIG_BUSMOUSE n
  2405. -bool 'PS/2 mouse (aka "auxiliary device") support' CONFIG_PSMOUSE y
  2406. +bool 'PS/2 mouse (aka "auxiliary device") support' CONFIG_PSMOUSE n
  2407.  if [ "$CONFIG_PSMOUSE" = "y" ]; then
  2408. -bool 'C&T 82C710 mouse port support (as on TI Travelmate)' CONFIG_82C710_MOUSE y
  2409. +bool 'C&T 82C710 mouse port support (as on TI Travelmate)' CONFIG_82C710_MOUSE n
  2410.  fi
  2411.  bool 'Microsoft busmouse support' CONFIG_MS_BUSMOUSE n
  2412.  bool 'ATIXL busmouse support' CONFIG_ATIXL_BUSMOUSE n
  2413. -bool 'Selection (cut and paste for virtual consoles)' CONFIG_SELECTION n
  2414. +bool 'Selection (cut and paste for virtual consoles)' CONFIG_SELECTION y
  2415.  bool 'QIC-02 tape support' CONFIG_TAPE_QIC02 n
  2416.  bool 'QIC-117 tape support' CONFIG_FTAPE n
  2417.  if [ "$CONFIG_FTAPE" = "y" ]; then
  2418. Only in linux.old: config.in.orig
  2419. Only in linux.old/drivers/block: README.sbpcd.o
  2420. Only in linux.old/drivers/block: floppy.c.orig
  2421. Only in linux.old/drivers/block: genhd.c.orig
  2422. Only in linux.old/drivers/block: hd.c.orig
  2423. Only in linux.old/drivers/block: ll_rw_blk.c.or
  2424. Only in linux.old/drivers/block: ramdisk.c.orig
  2425. Only in linux.old/drivers/block: sbpcd.c.orig
  2426. Only in linux.old/drivers/block: xd.c.orig
  2427. Only in linux.old/drivers/char: keyboard.c.ori
  2428. Only in linux.old/drivers/char: mem.c.orig
  2429. Only in linux.old/drivers/char: serial.c.orig
  2430. Only in linux.old/drivers/char: tty_io.c.orig
  2431. diff -u --new-file --recursive linux.old/drivers/net/3c501.c linux/drivers/net/3c501.c
  2432. --- linux.old/drivers/net/3c501.c    Fri May 20 18:42:25 1994
  2433. +++ linux/drivers/net/3c501.c    Fri May 20 18:51:10 1994
  2434. @@ -327,7 +327,7 @@
  2435.             " gp=%03x rp=%03x.\n", dev->name, txsr, axsr,
  2436.             inw(ioaddr + EL1_DATAPTR), inw(ioaddr + EL1_RXPTR));
  2437.          dev->tbusy = 0;
  2438. -        mark_bh(INET_BH);
  2439. +        mark_bh(NET_BH);
  2440.      } else if (txsr & TX_16COLLISIONS) {
  2441.          if (el_debug)
  2442.          printk("%s: Transmit failed 16 times, ethernet jammed?\n",
  2443. @@ -349,7 +349,7 @@
  2444.          printk(" Tx succeeded %s\n",
  2445.                 (txsr & TX_RDY) ? "." : "but tx is busy!");
  2446.          dev->tbusy = 0;
  2447. -        mark_bh(INET_BH);
  2448. +        mark_bh(NET_BH);
  2449.      }
  2450.      } else {
  2451.      int rxsr = inb(RX_STATUS);
  2452. Only in linux.old/drivers/net: 3c501.c.orig
  2453. Only in linux.old/drivers/net: 3c503.c.orig
  2454. diff -u --new-file --recursive linux.old/drivers/net/3c507.c linux/drivers/net/3c507.c
  2455. --- linux.old/drivers/net/3c507.c    Fri May 20 18:42:25 1994
  2456. +++ linux/drivers/net/3c507.c    Fri May 20 18:51:11 1994
  2457. @@ -530,7 +530,7 @@
  2458.          lp->stats.tx_packets++;
  2459.          lp->stats.collisions += tx_status & 0xf;
  2460.          dev->tbusy = 0;
  2461. -        mark_bh(INET_BH);        /* Inform upper layers. */
  2462. +        mark_bh(NET_BH);        /* Inform upper layers. */
  2463.        } else {
  2464.          lp->stats.tx_errors++;
  2465.          if (tx_status & 0x0600)  lp->stats.tx_carrier_errors++;
  2466. Only in linux.old/drivers/net: 3c507.c.orig
  2467. diff -u --new-file --recursive linux.old/drivers/net/3c509.c linux/drivers/net/3c509.c
  2468. --- linux.old/drivers/net/3c509.c    Fri May 20 18:46:15 1994
  2469. +++ linux/drivers/net/3c509.c    Fri May 20 18:51:07 1994
  2470. @@ -31,6 +31,10 @@
  2471.  #include <linux/netdevice.h>
  2472.  #include <linux/etherdevice.h>
  2473.  #include <linux/skbuff.h>
  2474. +#ifdef MODULE
  2475. +#include <linux/module.h>
  2476. +#include "../../tools/version.h"
  2477. +#endif
  2478.  
  2479.  
  2480.  
  2481. @@ -312,6 +316,9 @@
  2482.          printk("%s: Opened 3c509  IRQ %d  status %4.4x.\n",
  2483.                 dev->name, dev->irq, inw(ioaddr + EL3_STATUS));
  2484.  
  2485. +#ifdef MODULE
  2486. +    MOD_INC_USE_COUNT;
  2487. +#endif
  2488.      return 0;                    /* Always succeed */
  2489.  }
  2490.  
  2491. @@ -436,7 +443,7 @@
  2492.              /* There's room in the FIFO for a full-sized packet. */
  2493.              outw(0x6808, ioaddr + EL3_CMD); /* Ack IRQ */
  2494.              dev->tbusy = 0;
  2495. -            mark_bh(INET_BH);
  2496. +            mark_bh(NET_BH);
  2497.          }
  2498.          if (status & 0x80)                /* Statistics full. */
  2499.              update_stats(ioaddr, dev);
  2500. @@ -645,6 +652,9 @@
  2501.      irq2dev_map[dev->irq] = 0;
  2502.  
  2503.      update_stats(ioaddr, dev);
  2504. +#ifdef MODULE
  2505. +    MOD_DEC_USE_COUNT;
  2506. +#endif
  2507.      return 0;
  2508.  }
  2509.  
  2510. @@ -656,3 +666,29 @@
  2511.   *  tab-width: 4
  2512.   * End:
  2513.   */
  2514. +#ifdef MODULE
  2515. +char kernel_version[] = UTS_RELEASE;
  2516. +static struct device dev_3c509 = {
  2517. +    "" /*"3c509"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, el3_probe };
  2518. +
  2519. +int
  2520. +init_module(void)
  2521. +{
  2522. +    if (register_netdev(&dev_3c509) != 0)
  2523. +        return -EIO;
  2524. +    return 0;
  2525. +}
  2526. +
  2527. +void
  2528. +cleanup_module(void)
  2529. +{
  2530. +    if (MOD_IN_USE)
  2531. +        printk("3c509: device busy, remove delayed\n");
  2532. +    else
  2533. +    {
  2534. +        unregister_netdev(&dev_3c509);
  2535. +        kfree_s(dev_3c509.priv,sizeof(struct el3_private));
  2536. +        dev_3c509.priv=NULL;
  2537. +    }
  2538. +}
  2539. +#endif /* MODULE */
  2540. Only in linux.old/drivers/net: 3c509.c.orig
  2541. diff -u --new-file --recursive linux.old/drivers/net/8390.c linux/drivers/net/8390.c
  2542. --- linux.old/drivers/net/8390.c    Fri May 20 18:42:26 1994
  2543. +++ linux/drivers/net/8390.c    Fri May 20 18:51:08 1994
  2544. @@ -373,7 +373,7 @@
  2545.          if (status & ENTSR_OWC) ei_local->stat.tx_window_errors++;
  2546.      }
  2547.      
  2548. -    mark_bh (INET_BH);
  2549. +    mark_bh (NET_BH);
  2550.  }
  2551.  
  2552.  /* We have a good packet(s), get it/them out of the buffers. */
  2553. @@ -476,7 +476,7 @@
  2554.          outb(next_frame-1, e8390_base+EN0_BOUNDARY);
  2555.      }
  2556.      /* If any worth-while packets have been received, dev_rint()
  2557. -       has done a mark_bh(INET_BH) for us and will work on them
  2558. +       has done a mark_bh(NET_BH) for us and will work on them
  2559.         when we get to the bottom-half routine. */
  2560.  
  2561.      /* Record the maximum Rx packet queue. */
  2562. Only in linux.old/drivers/net: 8390.c.orig
  2563. diff -u --new-file --recursive linux.old/drivers/net/CONFIG linux/drivers/net/CONFIG
  2564. --- linux.old/drivers/net/CONFIG    Tue Feb 22 06:40:09 1994
  2565. +++ linux/drivers/net/CONFIG    Fri May 20 18:51:09 1994
  2566. @@ -26,10 +26,10 @@
  2567.  #  CONFIG_PLIP        The Crynwr-protocol PL/IP driver
  2568.  #    INITIALTIMEOUTFACTOR    Timing parameters.
  2569.  #    MAXTIMEOUTFACTOR
  2570. -#  D_LINK        The D-Link DE-600 Portable Ethernet Adaptor.
  2571. -#      D_LINK_IO    The D-Link I/O address (0x378 == typical)
  2572. -#      D_LINK_IRQ    The D-Link IRQ number to use (IRQ7 == typical)
  2573. -#      D_LINK_DEBUG    Enable or disable D-Link debugging
  2574. +#  DE600        The D-Link DE-600 Portable Ethernet Adaptor.
  2575. +#      DE600_IO    The DE600 I/O-port address (0x378 == default)
  2576. +#      DE600_IRQ    The DE600 IRQ number to use (IRQ7 == default)
  2577. +#      DE600_DEBUG    Enable or disable DE600 debugging (default off)
  2578.  #  DEPCA        The DIGITAL series of AT Ethernet Cards (DE100, DE200)
  2579.  #      DEPCA_IRQ    Set the desired IRQ (=0, for autoprobe)
  2580.  #      DEPCA_DEBUG    Set the desired debug level
  2581. @@ -54,6 +54,3 @@
  2582.  HP_OPTS        =
  2583.  PLIP_OPTS    =
  2584.  DEPCA_OPTS    = -DDEPCA_IRQ=0 -DDEPCA_DEBUG=1
  2585. -
  2586. -# The following are the only parameters that must be set in this file.
  2587. -DL_OPTS        = -DD_LINK_IO=0x378 -DD_LINK_IRQ=7 -UD_LINK_DEBUG
  2588. diff -u --new-file --recursive linux.old/drivers/net/MODULES linux/drivers/net/MODULES
  2589. --- linux.old/drivers/net/MODULES    Thu Jan  1 01:00:00 1970
  2590. +++ linux/drivers/net/MODULES    Fri May 20 18:51:11 1994
  2591. @@ -0,0 +1,3 @@
  2592. +MODULES = \
  2593. +    3c509.o \
  2594. +    de600.o
  2595. diff -u --new-file --recursive linux.old/drivers/net/Makefile linux/drivers/net/Makefile
  2596. --- linux.old/drivers/net/Makefile    Fri May 20 18:42:26 1994
  2597. +++ linux/drivers/net/Makefile    Fri May 20 18:51:10 1994
  2598. @@ -6,16 +6,17 @@
  2599.  # This will go away in some future future: hidden configuration files
  2600.  # are difficult for users to deal with.
  2601.  include CONFIG
  2602. +include MODULES
  2603.  
  2604.  NETDRV_OBJS := net.a(Space.o) net.a(auto_irq.o) net.a(net_init.o) net.a(loopback.o)
  2605.  CFLAGS := $(CFLAGS) -I../../net/inet
  2606.  CPP := $(CPP) -I../../net/inet
  2607.  
  2608.  # The point of the makefile...
  2609. -all: net.a
  2610. +all: net.a modules
  2611.  
  2612.  Space.o: Space.c ../../include/linux/autoconf.h
  2613. -    $(CC) $(CFLAGS) $(OPTS) $(DL_OPTS) -c $< -o $@
  2614. +    $(CC) $(CFLAGS) $(OPTS) -c $< -o $@
  2615.  
  2616.  net_init.o: ../../include/linux/autoconf.h
  2617.  
  2618. @@ -74,11 +75,8 @@
  2619.  endif
  2620.  
  2621.  ifdef CONFIG_DE600
  2622. -NETDRV_OBJS := $(NETDRV_OBJS) net.a(d_link.o)
  2623. -d_link.o: d_link.c CONFIG
  2624. -    $(CC) $(CPPFLAGS) $(CFLAGS) $(DL_OPTS) -c $<
  2625. +NETDRV_OBJS := $(NETDRV_OBJS) net.a(de600.o)
  2626.  endif
  2627. -
  2628.  ifdef CONFIG_AT1500
  2629.  NETDRV_OBJS := $(NETDRV_OBJS) net.a(lance.o)
  2630.  endif
  2631. @@ -129,8 +127,11 @@
  2632.  NETDRV_OBJS := $(NETDRV_OBJS) net.a(8390.o)
  2633.  endif
  2634.  
  2635. -ifdef CONFIG_IP_DEFRAG
  2636. -NETDRV_OBJS := $(NETDRV_OBJS) net.a(ip-frag.o)
  2637. +ifdef CONFIG_PI
  2638. +NETDRV_OBJS := $(NETDRV_OBJS) net.a(pi2.o)
  2639. +CONFIG_PI = CONFIG_PI
  2640. +pi2.o:  pi2.c CONFIG
  2641. +    $(CC) $(CPPFLAGS) $(CFLAGS) $(PI_OPTS) -c $<
  2642.  endif
  2643.  
  2644.  net.a: $(NETDRV_OBJS)
  2645. @@ -144,6 +145,18 @@
  2646.  
  2647.  tar:
  2648.  
  2649. +ifdef MODULES
  2650. +
  2651. +modules:
  2652. +    echo $(MODULES) > ../../modules/NET_MODULES
  2653. +    $(MAKE) CFLAGS="$(CFLAGS) -DMODULE" $(MODULES)
  2654. +    (cd ../../modules;for i in $(MODULES); do ln -sf ../drivers/net/$$i .; done)
  2655. +
  2656. +else
  2657. +
  2658. +modules:
  2659. +
  2660. +endif
  2661.  
  2662.  # include a dependency file if one exists
  2663.  
  2664. Only in linux.old/drivers/net: Makefile.orig
  2665. diff -u --new-file --recursive linux.old/drivers/net/Space.c linux/drivers/net/Space.c
  2666. --- linux.old/drivers/net/Space.c    Fri May 20 18:42:26 1994
  2667. +++ linux/drivers/net/Space.c    Fri May 20 18:51:09 1994
  2668. @@ -25,7 +25,6 @@
  2669.   *        2 of the License, or (at your option) any later version.
  2670.   */
  2671.  #include <linux/config.h>
  2672. -#include <linux/ddi.h>
  2673.  #include <linux/netdevice.h>
  2674.  
  2675.  #define LOOPBACK            /* always present, right?    */
  2676. @@ -56,7 +55,7 @@
  2677.  
  2678.  /* Detachable devices ("pocket adaptors" and special PCMCIA drivers). */
  2679.  extern int atp_init(struct device *);
  2680. -extern int d_link_init(struct device *);
  2681. +extern int de600_probe(struct device *);
  2682.  
  2683.  static int
  2684.  ethif_probe(struct device *dev)
  2685. @@ -115,20 +114,15 @@
  2686.  #ifdef CONFIG_E2100        /* Cabletron E21xx series. */
  2687.      && e2100_probe(dev)
  2688.  #endif
  2689. +#ifdef CONFIG_DE600
  2690. +    && de600_probe(dev)
  2691. +#endif
  2692.      && 1 ) {
  2693.      return 1;    /* -ENODEV or -EAGAIN would be more accurate. */
  2694.      }
  2695.      return 0;
  2696.  }
  2697.  
  2698. -
  2699. -/* This remains seperate because it requires the addr and IRQ to be set. */
  2700. -#if defined(D_LINK) || defined(CONFIG_DE600)
  2701. -static struct device d_link_dev = {
  2702. -    "dl0", 0, 0, 0, 0, D_LINK_IO, D_LINK_IRQ, 0, 0, 0, NEXT_DEV, d_link_init };
  2703. -#   undef NEXT_DEV
  2704. -#   define NEXT_DEV    (&d_link_dev)
  2705. -#endif
  2706.  
  2707.  /* Run-time ATtachable (Pocket) devices have a different (not "eth#") name. */
  2708.  #ifdef CONFIG_ATP        /* AT-LAN-TEC (RealTek) pocket adaptor. */
  2709. Only in linux.old/drivers/net: Space.c.orig
  2710. diff -u --new-file --recursive linux.old/drivers/net/at1700.c linux/drivers/net/at1700.c
  2711. --- linux.old/drivers/net/at1700.c    Fri May 20 18:42:27 1994
  2712. +++ linux/drivers/net/at1700.c    Fri May 20 18:51:12 1994
  2713. @@ -448,7 +448,7 @@
  2714.                  lp->tx_queue_len = 0;
  2715.                  dev->trans_start = jiffies;
  2716.                  dev->tbusy = 0;
  2717. -                mark_bh(INET_BH);    /* Inform upper layers. */
  2718. +                mark_bh(NET_BH);    /* Inform upper layers. */
  2719.              } else {
  2720.                  lp->tx_started = 0;
  2721.                  /* Turn on Tx interrupts off. */
  2722. @@ -529,7 +529,7 @@
  2723.      }
  2724.  
  2725.      /* If any worth-while packets have been received, dev_rint()
  2726. -       has done a mark_bh(INET_BH) for us and will work on them
  2727. +       has done a mark_bh(NET_BH) for us and will work on them
  2728.         when we get to the bottom-half routine. */
  2729.      {
  2730.          int i;
  2731. Only in linux.old/drivers/net: at1700.c.orig
  2732. diff -u --new-file --recursive linux.old/drivers/net/atp.c linux/drivers/net/atp.c
  2733. --- linux.old/drivers/net/atp.c    Fri May 20 18:42:28 1994
  2734. +++ linux/drivers/net/atp.c    Fri May 20 18:51:10 1994
  2735. @@ -558,7 +558,7 @@
  2736.                  } else
  2737.                      lp->tx_unit_busy = 0;
  2738.                  dev->tbusy = 0;
  2739. -                mark_bh(INET_BH);    /* Inform upper layers. */
  2740. +                mark_bh(NET_BH);    /* Inform upper layers. */
  2741.              }
  2742.              num_tx_since_rx++;
  2743.          } else if (num_tx_since_rx > 8
  2744. Only in linux.old/drivers/net: atp.c.orig
  2745. Only in linux.old/drivers/net: auto_irq.c.ori
  2746. Only in linux.old/drivers/net: d_link.c
  2747. Only in linux.old/drivers/net: d_link.c.orig
  2748. diff -u --new-file --recursive linux.old/drivers/net/de600.c linux/drivers/net/de600.c
  2749. --- linux.old/drivers/net/de600.c    Thu Jan  1 01:00:00 1970
  2750. +++ linux/drivers/net/de600.c    Fri May 20 18:51:19 1994
  2751. @@ -0,0 +1,772 @@
  2752. +static char *version =
  2753. +    "de600.c: $Revision: 1.35 $,  Bjorn Ekwall (bj0rn@blox.se)\n";
  2754. +/*
  2755. + *    de600.c
  2756. + *
  2757. + *    Linux driver for the D-Link DE-600 Ethernet pocket adapter.
  2758. + *
  2759. + *    Portions (C) Copyright 1993 by Bjorn Ekwall
  2760. + *    The Author may be reached as bj0rn@blox.se
  2761. + *
  2762. + *    Based on adapter information gathered from DE600.ASM by D-Link Inc.,
  2763. + *    as included on disk C in the v.2.11 of PC/TCP from FTP Software.
  2764. + *    For DE600.asm:
  2765. + *        Portions (C) Copyright 1990 D-Link, Inc.
  2766. + *        Copyright, 1988-1992, Russell Nelson, Crynwr Software
  2767. + *
  2768. + *    Adapted to the sample network driver core for linux,
  2769. + *    written by: Donald Becker <becker@super.org>
  2770. + *    C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
  2771. + *
  2772. + *    compile-command:
  2773. + *    "gcc -D__KERNEL__  -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer \
  2774. + *     -m486 -c de600.c
  2775. + *
  2776. + **************************************************************/
  2777. +/*
  2778. + *    This program is free software; you can redistribute it and/or modify
  2779. + *    it under the terms of the GNU General Public License as published by
  2780. + *    the Free Software Foundation; either version 2, or (at your option)
  2781. + *    any later version.
  2782. + *
  2783. + *    This program is distributed in the hope that it will be useful,
  2784. + *    but WITHOUT ANY WARRANTY; without even the implied warranty of
  2785. + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2786. + *    GNU General Public License for more details.
  2787. + *
  2788. + *    You should have received a copy of the GNU General Public License
  2789. + *    along with this program; if not, write to the Free Software
  2790. + *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  2791. + *
  2792. + **************************************************************/
  2793. +/* Add another "; SLOW_DOWN_IO" here if your adapter won't work OK: */
  2794. +#define DE600_SLOW_DOWN SLOW_DOWN_IO; SLOW_DOWN_IO; SLOW_DOWN_IO
  2795. +
  2796. + /*
  2797. + * If you still have trouble reading/writing to the adapter,
  2798. + * modify the following "#define": (see <asm/io.h> for more info)
  2799. +#define REALLY_SLOW_IO
  2800. + */
  2801. +#define SLOW_IO_BY_JUMPING /* Looks "better" than dummy write to port 0x80 :-) */
  2802. +
  2803. +/*
  2804. + * For fix to TCP "slowdown", take a look at the "#define DE600_MAX_WINDOW"
  2805. + * near the end of the file...
  2806. + */
  2807. +
  2808. +/* use 0 for production, 1 for verification, >2 for debug */
  2809. +#ifdef DE600_DEBUG
  2810. +#define PRINTK(x) if (de600_debug >= 2) printk x
  2811. +#else
  2812. +#define DE600_DEBUG 0
  2813. +#define PRINTK(x) /**/
  2814. +#endif
  2815. +static unsigned int de600_debug = DE600_DEBUG;
  2816. +
  2817. +#include <linux/config.h>
  2818. +#include <linux/kernel.h>
  2819. +#include <linux/sched.h>
  2820. +#include <linux/types.h>
  2821. +#include <linux/fcntl.h>
  2822. +#include <linux/string.h>
  2823. +#include <linux/interrupt.h>
  2824. +#include <asm/io.h>
  2825. +#include <netinet/in.h>
  2826. +#include <linux/ptrace.h>
  2827. +#include <asm/system.h>
  2828. +#include <errno.h>
  2829. +
  2830. +#include <linux/inet.h>
  2831. +#include <linux/netdevice.h>
  2832. +#include <linux/etherdevice.h>
  2833. +#include <linux/skbuff.h>
  2834. +
  2835. +#ifdef MODULE
  2836. +#include <linux/module.h>
  2837. +#include "../../tools/version.h"
  2838. +#endif
  2839. +
  2840. +#define netstats enet_statistics
  2841. +
  2842. +/**************************************************
  2843. + *                                                *
  2844. + * Definition of D-Link Ethernet Pocket adapter   *
  2845. + *                                                *
  2846. + **************************************************/
  2847. +/*
  2848. + * D-Link Ethernet pocket adapter ports
  2849. + */
  2850. +/*
  2851. + * OK, so I'm cheating, but there are an awful lot of
  2852. + * reads and writes in order to get anything in and out
  2853. + * of the DE-600 with 4 bits at a time in the parallel port,
  2854. + * so every saved instruction really helps :-)
  2855. + *
  2856. + * That is, I don't care what the device struct says
  2857. + * but hope that Space.c will keep the rest of the drivers happy.
  2858. + */
  2859. +#ifndef DE600_IO
  2860. +#define DE600_IO 0x378
  2861. +#endif
  2862. +
  2863. +#define DATA_PORT    (DE600_IO)
  2864. +#define STATUS_PORT    (DE600_IO + 1)
  2865. +#define COMMAND_PORT    (DE600_IO + 2)
  2866. +
  2867. +#ifndef DE600_IRQ
  2868. +#define DE600_IRQ    7
  2869. +#endif
  2870. +/*
  2871. + * It really should look like this, and autoprobing as well...
  2872. + *
  2873. +#define DATA_PORT    (dev->base_addr + 0)
  2874. +#define STATUS_PORT    (dev->base_addr + 1)
  2875. +#define COMMAND_PORT    (dev->base_addr + 2)
  2876. +#define DE600_IRQ    dev->irq
  2877. + */
  2878. +
  2879. +/*
  2880. + * D-Link COMMAND_PORT commands
  2881. + */
  2882. +#define SELECT_NIC    0x04 /* select Network Interface Card */
  2883. +#define SELECT_PRN    0x1c /* select Printer */
  2884. +#define NML_PRN        0xec /* normal Printer situation */
  2885. +#define IRQEN        0x10 /* enable IRQ line */
  2886. +
  2887. +/*
  2888. + * D-Link STATUS_PORT
  2889. + */
  2890. +#define RX_BUSY        0x80
  2891. +#define RX_GOOD        0x40
  2892. +#define TX_FAILED16    0x10
  2893. +#define TX_BUSY        0x08
  2894. +
  2895. +/*
  2896. + * D-Link DATA_PORT commands
  2897. + * command in low 4 bits
  2898. + * data in high 4 bits
  2899. + * select current data nibble with HI_NIBBLE bit
  2900. + */
  2901. +#define WRITE_DATA    0x00 /* write memory */
  2902. +#define READ_DATA    0x01 /* read memory */
  2903. +#define STATUS        0x02 /* read  status register */
  2904. +#define COMMAND        0x03 /* write command register (see COMMAND below) */
  2905. +#define NULL_COMMAND    0x04 /* null command */
  2906. +#define RX_LEN        0x05 /* read  received packet length */
  2907. +#define TX_ADDR        0x06 /* set adapter transmit memory address */
  2908. +#define RW_ADDR        0x07 /* set adapter read/write memory address */
  2909. +#define HI_NIBBLE    0x08 /* read/write the high nibble of data,
  2910. +                or-ed with rest of command */
  2911. +
  2912. +/*
  2913. + * command register, accessed through DATA_PORT with low bits = COMMAND
  2914. + */
  2915. +#define RX_ALL        0x01 /* PROMISCIOUS */
  2916. +#define RX_BP        0x02 /* default: BROADCAST & PHYSICAL ADRESS */
  2917. +#define RX_MBP        0x03 /* MULTICAST, BROADCAST & PHYSICAL ADRESS */
  2918. +
  2919. +#define TX_ENABLE    0x04 /* bit 2 */
  2920. +#define RX_ENABLE    0x08 /* bit 3 */
  2921. +
  2922. +#define RESET        0x80 /* set bit 7 high */
  2923. +#define STOP_RESET    0x00 /* set bit 7 low */
  2924. +
  2925. +/*
  2926. + * data to command register
  2927. + * (high 4 bits in write to DATA_PORT)
  2928. + */
  2929. +#define RX_PAGE2_SELECT    0x10 /* bit 4, only 2 pages to select */
  2930. +#define RX_BASE_PAGE    0x20 /* bit 5, always set when specifying RX_ADDR */
  2931. +#define FLIP_IRQ    0x40 /* bit 6 */
  2932. +
  2933. +/*
  2934. + * D-Link adapter internal memory:
  2935. + *
  2936. + * 0-2K 1:st transmit page (send from pointer up to 2K)
  2937. + * 2-4K    2:nd transmit page (send from pointer up to 4K)
  2938. + *
  2939. + * 4-6K 1:st receive page (data from 4K upwards)
  2940. + * 6-8K 2:nd receive page (data from 6K upwards)
  2941. + *
  2942. + * 8K+    Adapter ROM (contains magic code and last 3 bytes of Ethernet address)
  2943. + */
  2944. +#define MEM_2K        0x0800 /* 2048 */
  2945. +#define MEM_4K        0x1000 /* 4096 */
  2946. +#define MEM_6K        0x1800 /* 6144 */
  2947. +#define NODE_ADDRESS    0x2000 /* 8192 */
  2948. +
  2949. +#define RUNT 60        /* Too small Ethernet packet */
  2950. +
  2951. +/**************************************************
  2952. + *                                                *
  2953. + *             End of definition                  *
  2954. + *                                                *
  2955. + **************************************************/
  2956. +
  2957. +/*
  2958. + * Index to functions, as function prototypes.
  2959. + */
  2960. +#if 0
  2961. +/* For tricking tcp.c to announce a small max window (max 2 fast packets please :-) */
  2962. +static unsigned long    de600_rspace(struct sock *sk);
  2963. +#endif
  2964. +
  2965. +/* Routines used internally. (See "convenience macros") */
  2966. +static int        de600_read_status(struct device *dev);
  2967. +static unsigned    char    de600_read_byte(unsigned char type, struct device *dev);
  2968. +
  2969. +/* Put in the device structure. */
  2970. +static int    de600_open(struct device *dev);
  2971. +static int    de600_close(struct device *dev);
  2972. +static struct netstats *get_stats(struct device *dev);
  2973. +static int    de600_start_xmit(struct sk_buff *skb, struct device *dev);
  2974. +
  2975. +/* Dispatch from interrupts. */
  2976. +static void    de600_interrupt(int reg_ptr);
  2977. +static int    de600_tx_intr(struct device *dev, int irq_status);
  2978. +static void    de600_rx_intr(struct device *dev);
  2979. +
  2980. +/* Initialization */
  2981. +static void    trigger_interrupt(struct device *dev);
  2982. +int        de600_probe(struct device *dev);
  2983. +static void    adapter_init(struct device *dev);
  2984. +
  2985. +/*
  2986. + * D-Link driver variables:
  2987. + */
  2988. +extern struct device        *irq2dev_map[16];
  2989. +static volatile int        rx_page        = 0;
  2990. +
  2991. +#define TX_PAGES 2
  2992. +static volatile int        tx_fifo[TX_PAGES];
  2993. +static volatile int        tx_fifo_in = 0;
  2994. +static volatile int        tx_fifo_out = 0;
  2995. +static volatile int        free_tx_pages = TX_PAGES;
  2996. +
  2997. +/*
  2998. + * Convenience macros/functions for D-Link adapter
  2999. + */
  3000. +
  3001. +#define select_prn() outb_p(SELECT_PRN, COMMAND_PORT); DE600_SLOW_DOWN
  3002. +#define select_nic() outb_p(SELECT_NIC, COMMAND_PORT); DE600_SLOW_DOWN
  3003. +
  3004. +/* Thanks for hints from Mark Burton <markb@ordern.demon.co.uk> */
  3005. +#define de600_put_byte(data) ( \
  3006. +    outb_p(((data) << 4)   | WRITE_DATA            , DATA_PORT), \
  3007. +    outb_p(((data) & 0xf0) | WRITE_DATA | HI_NIBBLE, DATA_PORT))
  3008. +
  3009. +/*
  3010. + * The first two outb_p()'s below could perhaps be deleted if there
  3011. + * would be more delay in the last two. Not certain about it yet...
  3012. + */
  3013. +#define de600_put_command(cmd) ( \
  3014. +    outb_p(( rx_page        << 4)   | COMMAND            , DATA_PORT), \
  3015. +    outb_p(( rx_page        & 0xf0) | COMMAND | HI_NIBBLE, DATA_PORT), \
  3016. +    outb_p(((rx_page | cmd) << 4)   | COMMAND            , DATA_PORT), \
  3017. +    outb_p(((rx_page | cmd) & 0xf0) | COMMAND | HI_NIBBLE, DATA_PORT))
  3018. +
  3019. +#define de600_setup_address(addr,type) ( \
  3020. +    outb_p((((addr) << 4) & 0xf0) | type            , DATA_PORT), \
  3021. +    outb_p(( (addr)       & 0xf0) | type | HI_NIBBLE, DATA_PORT), \
  3022. +    outb_p((((addr) >> 4) & 0xf0) | type            , DATA_PORT), \
  3023. +    outb_p((((addr) >> 8) & 0xf0) | type | HI_NIBBLE, DATA_PORT))
  3024. +
  3025. +#define rx_page_adr() ((rx_page & RX_PAGE2_SELECT)?(MEM_6K):(MEM_4K))
  3026. +
  3027. +/* Flip bit, only 2 pages */
  3028. +#define next_rx_page() (rx_page ^= RX_PAGE2_SELECT)
  3029. +
  3030. +#define tx_page_adr(a) (((a) + 1) * MEM_2K)
  3031. +
  3032. +static inline int
  3033. +de600_read_status(struct device *dev)
  3034. +{
  3035. +    int    status;
  3036. +
  3037. +    outb_p(STATUS, DATA_PORT);
  3038. +    status = inb(STATUS_PORT);
  3039. +    outb_p(NULL_COMMAND | HI_NIBBLE, DATA_PORT);
  3040. +
  3041. +    return status;
  3042. +}
  3043. +
  3044. +static inline unsigned char
  3045. +de600_read_byte(unsigned char type, struct device *dev) { /* dev used by macros */
  3046. +    unsigned char    lo;
  3047. +
  3048. +    (void)outb_p((type), DATA_PORT);
  3049. +    lo = ((unsigned char)inb(STATUS_PORT)) >> 4;
  3050. +    (void)outb_p((type) | HI_NIBBLE, DATA_PORT);
  3051. +    return ((unsigned char)inb(STATUS_PORT) & (unsigned char)0xf0) | lo;
  3052. +}
  3053. +
  3054. +/*
  3055. + * Open/initialize the board.  This is called (in the current kernel)
  3056. + * after booting when 'ifconfig <dev->name> $IP_ADDR' is run (in rc.inet1).
  3057. + *
  3058. + * This routine should set everything up anew at each open, even
  3059. + * registers that "should" only need to be set once at boot, so that
  3060. + * there is a non-reboot way to recover if something goes wrong.
  3061. + */
  3062. +static int
  3063. +de600_open(struct device *dev)
  3064. +{
  3065. +#if 0
  3066. +    extern struct proto tcp_prot;
  3067. +#endif
  3068. +
  3069. +    if (request_irq(DE600_IRQ, de600_interrupt)) {
  3070. +        printk ("%s: unable to get IRQ %d\n", dev->name, DE600_IRQ);
  3071. +        return 1;
  3072. +    }
  3073. +    irq2dev_map[DE600_IRQ] = dev;
  3074. +
  3075. +#ifdef MODULE
  3076. +    MOD_INC_USE_COUNT;
  3077. +#endif
  3078. +    adapter_init(dev);
  3079. +
  3080. +    /*
  3081. +     * Yes, I know!
  3082. +     * This is really not nice, but since a machine that uses DE-600
  3083. +     * rarely uses any other TCP/IP connection device simultaneously,
  3084. +     * this hack shouldn't really slow anything up.
  3085. +     * (I don't know about slip though... but it won't break it)
  3086. +     *
  3087. +     * This fix is better than changing in tcp.h IMHO
  3088. +     */
  3089. +#if 0     
  3090. +    tcp_prot.rspace = de600_rspace; /* was: sock_rspace */
  3091. +#endif
  3092. +
  3093. +
  3094. +    return 0;
  3095. +}
  3096. +
  3097. +/*
  3098. + * The inverse routine to de600_open().
  3099. + */
  3100. +static int
  3101. +de600_close(struct device *dev)
  3102. +{
  3103. +    select_nic();
  3104. +    rx_page = 0;
  3105. +    de600_put_command(RESET);
  3106. +    de600_put_command(STOP_RESET);
  3107. +    de600_put_command(0);
  3108. +    select_prn();
  3109. +
  3110. +    free_irq(DE600_IRQ);
  3111. +    irq2dev_map[DE600_IRQ] = NULL;
  3112. +    dev->start = 0;
  3113. +#ifdef MODULE
  3114. +    MOD_DEC_USE_COUNT;
  3115. +#endif
  3116. +#if 0
  3117. +    tcp_prot.rspace = sock_rspace; /* see comment above! */
  3118. +#endif
  3119. +    return 0;
  3120. +}
  3121. +
  3122. +static struct netstats *
  3123. +get_stats(struct device *dev)
  3124. +{
  3125. +    return (struct netstats *)(dev->priv);
  3126. +}
  3127. +
  3128. +static inline void
  3129. +trigger_interrupt(struct device *dev)
  3130. +{
  3131. +    de600_put_command(FLIP_IRQ);
  3132. +    select_prn();
  3133. +    DE600_SLOW_DOWN;
  3134. +    select_nic();
  3135. +    de600_put_command(0);
  3136. +}
  3137. +
  3138. +/*
  3139. + * Copy a buffer to the adapter transmit page memory.
  3140. + * Start sending.
  3141. + */
  3142. +static int
  3143. +de600_start_xmit(struct sk_buff *skb, struct device *dev)
  3144. +{
  3145. +    int        transmit_from;
  3146. +    int        len;
  3147. +    int        tickssofar;
  3148. +    unsigned char    *buffer = skb->data;
  3149. +
  3150. +    /*
  3151. +     * If some higher layer thinks we've missed a
  3152. +     * tx-done interrupt we are passed NULL.
  3153. +     * Caution: dev_tint() handles the cli()/sti() itself.
  3154. +     */
  3155. +
  3156. +    if (skb == NULL) {
  3157. +        dev_tint(dev);
  3158. +        return 0;
  3159. +    }
  3160. +
  3161. +    if (free_tx_pages <= 0) {    /* Do timeouts, to avoid hangs. */
  3162. +        tickssofar = jiffies - dev->trans_start;
  3163. +
  3164. +        if (tickssofar < 5)
  3165. +            return 1;
  3166. +
  3167. +        /* else */
  3168. +        printk("%s: transmit timed out (%d), %s?\n",
  3169. +            dev->name,
  3170. +            tickssofar,
  3171. +            "network cable problem"
  3172. +            );
  3173. +        /* Restart the adapter. */
  3174. +        adapter_init(dev);
  3175. +    }
  3176. +
  3177. +    /* Start real output */
  3178. +    PRINTK(("de600_start_xmit:len=%d, page %d/%d\n", skb->len, tx_fifo_in, free_tx_pages));
  3179. +
  3180. +    if ((len = skb->len) < RUNT)
  3181. +        len = RUNT;
  3182. +
  3183. +    cli();
  3184. +    select_nic();
  3185. +
  3186. +    tx_fifo[tx_fifo_in] = transmit_from = tx_page_adr(tx_fifo_in) - len;
  3187. +    tx_fifo_in = (tx_fifo_in + 1) % TX_PAGES; /* Next free tx page */
  3188. +
  3189. +    de600_setup_address(transmit_from, RW_ADDR);
  3190. +    for ( ; len > 0; --len, ++buffer)
  3191. +        de600_put_byte(*buffer);
  3192. +
  3193. +    if (free_tx_pages-- == TX_PAGES) { /* No transmission going on */
  3194. +        dev->trans_start = jiffies;
  3195. +        dev->tbusy = 0;    /* allow more packets into adapter */
  3196. +        /* Send page and generate an interrupt */
  3197. +        de600_setup_address(transmit_from, TX_ADDR);
  3198. +        de600_put_command(TX_ENABLE);
  3199. +    }
  3200. +    else {
  3201. +        dev->tbusy = !free_tx_pages;
  3202. +        select_prn();
  3203. +    }
  3204. +    
  3205. +    sti(); /* interrupts back on */
  3206. +    
  3207. +    if (skb->free)
  3208. +        kfree_skb (skb, FREE_WRITE);
  3209. +
  3210. +    return 0;
  3211. +}
  3212. +
  3213. +/*
  3214. + * The typical workload of the driver:
  3215. + * Handle the network interface interrupts.
  3216. + */
  3217. +static void
  3218. +de600_interrupt(int reg_ptr)
  3219. +{
  3220. +    int        irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
  3221. +    struct device    *dev = irq2dev_map[irq];
  3222. +    unsigned char    irq_status;
  3223. +    int        retrig = 0;
  3224. +    int        boguscount = 0;
  3225. +
  3226. +    /* This might just as well be deleted now, no crummy drivers present :-) */
  3227. +    if ((dev == NULL) || (dev->start == 0) || (DE600_IRQ != irq)) {
  3228. +        printk("%s: bogus interrupt %d\n", dev?dev->name:"DE-600", irq);
  3229. +        return;
  3230. +    }
  3231. +
  3232. +    dev->interrupt = 1;
  3233. +    select_nic();
  3234. +    irq_status = de600_read_status(dev);
  3235. +
  3236. +    do {
  3237. +        PRINTK(("de600_interrupt (%2.2X)\n", irq_status));
  3238. +
  3239. +        if (irq_status & RX_GOOD)
  3240. +            de600_rx_intr(dev);
  3241. +        else if (!(irq_status & RX_BUSY))
  3242. +            de600_put_command(RX_ENABLE);
  3243. +
  3244. +        /* Any transmission in progress? */
  3245. +        if (free_tx_pages < TX_PAGES)
  3246. +            retrig = de600_tx_intr(dev, irq_status);
  3247. +        else
  3248. +            retrig = 0;
  3249. +
  3250. +        irq_status = de600_read_status(dev);
  3251. +    } while ( (irq_status & RX_GOOD) || ((++boguscount < 10) && retrig) );
  3252. +    /*
  3253. +     * Yeah, it _looks_ like busy waiting, smells like busy waiting
  3254. +     * and I know it's not PC, but please, it will only occur once
  3255. +     * in a while and then only for a loop or so (< 1ms for sure!)
  3256. +     */
  3257. +
  3258. +    /* Enable adapter interrupts */
  3259. +    dev->interrupt = 0;
  3260. +    select_prn();
  3261. +
  3262. +    if (retrig)
  3263. +        trigger_interrupt(dev);
  3264. +
  3265. +    sti();
  3266. +    return;
  3267. +}
  3268. +
  3269. +static int
  3270. +de600_tx_intr(struct device *dev, int irq_status)
  3271. +{
  3272. +    /*
  3273. +     * Returns 1 if tx still not done
  3274. +     */
  3275. +
  3276. +    mark_bh(NET_BH);
  3277. +    /* Check if current transmission is done yet */
  3278. +    if (irq_status & TX_BUSY)
  3279. +        return 1; /* tx not done, try again */
  3280. +
  3281. +    /* else */
  3282. +    /* If last transmission OK then bump fifo index */
  3283. +    if (!(irq_status & TX_FAILED16)) {
  3284. +        tx_fifo_out = (tx_fifo_out + 1) % TX_PAGES;
  3285. +        ++free_tx_pages;
  3286. +        ((struct netstats *)(dev->priv))->tx_packets++;
  3287. +        dev->tbusy = 0;
  3288. +    }
  3289. +
  3290. +    /* More to send, or resend last packet? */
  3291. +    if ((free_tx_pages < TX_PAGES) || (irq_status & TX_FAILED16)) {
  3292. +        dev->trans_start = jiffies;
  3293. +        de600_setup_address(tx_fifo[tx_fifo_out], TX_ADDR);
  3294. +        de600_put_command(TX_ENABLE);
  3295. +        return 1;
  3296. +    }
  3297. +    /* else */
  3298. +
  3299. +    return 0;
  3300. +}
  3301. +
  3302. +/*
  3303. + * We have a good packet, get it out of the adapter.
  3304. + */
  3305. +static void
  3306. +de600_rx_intr(struct device *dev)
  3307. +{
  3308. +    struct sk_buff    *skb;
  3309. +    int        i;
  3310. +    int        read_from;
  3311. +    int        size;
  3312. +    register unsigned char    *buffer;
  3313. +
  3314. +    cli();
  3315. +    /* Get size of received packet */
  3316. +    size = de600_read_byte(RX_LEN, dev);    /* low byte */
  3317. +    size += (de600_read_byte(RX_LEN, dev) << 8);    /* high byte */
  3318. +    size -= 4;    /* Ignore trailing 4 CRC-bytes */
  3319. +
  3320. +    /* Tell adapter where to store next incoming packet, enable receiver */
  3321. +    read_from = rx_page_adr();
  3322. +    next_rx_page();
  3323. +    de600_put_command(RX_ENABLE);
  3324. +    sti();
  3325. +
  3326. +    if ((size < 32)  ||  (size > 1535))
  3327. +        printk("%s: Bogus packet size %d.\n", dev->name, size);
  3328. +
  3329. +    skb = alloc_skb(size, GFP_ATOMIC);
  3330. +    sti();
  3331. +    if (skb == NULL) {
  3332. +        printk("%s: Couldn't allocate a sk_buff of size %d.\n",
  3333. +            dev->name, size);
  3334. +        return;
  3335. +    }
  3336. +    /* else */
  3337. +
  3338. +    skb->lock = 0;
  3339. +    /* 'skb->data' points to the start of sk_buff data area. */
  3340. +    buffer = skb->data;
  3341. +
  3342. +    /* copy the packet into the buffer */
  3343. +    de600_setup_address(read_from, RW_ADDR);
  3344. +    for (i = size; i > 0; --i, ++buffer)
  3345. +        *buffer = de600_read_byte(READ_DATA, dev);
  3346. +    
  3347. +    ((struct netstats *)(dev->priv))->rx_packets++; /* count all receives */
  3348. +
  3349. +    if (dev_rint((unsigned char *)skb, size, IN_SKBUFF, dev))
  3350. +        printk("%s: receive buffers full.\n", dev->name);
  3351. +    /*
  3352. +     * If any worth-while packets have been received, dev_rint()
  3353. +     * has done a mark_bh(INET_BH) for us and will work on them
  3354. +     * when we get to the bottom-half routine.
  3355. +     */
  3356. +}
  3357. +
  3358. +int
  3359. +de600_probe(struct device *dev)
  3360. +{
  3361. +    int    i;
  3362. +    static struct netstats de600_netstats;
  3363. +    /*dev->priv = kmalloc(sizeof(struct netstats), GFP_KERNEL);*/
  3364. +
  3365. +    printk("%s: D-Link DE-600 pocket adapter", dev->name);
  3366. +    /* Alpha testers must have the version number to report bugs. */
  3367. +    if (de600_debug > 1)
  3368. +        printk(version);
  3369. +
  3370. +    /* probe for adapter */
  3371. +    rx_page = 0;
  3372. +    select_nic();
  3373. +    (void)de600_read_status(dev);
  3374. +    de600_put_command(RESET);
  3375. +    de600_put_command(STOP_RESET);
  3376. +    if (de600_read_status(dev) & 0xf0) {
  3377. +        printk(": not at I/O %#3x.\n", DATA_PORT);
  3378. +        return ENODEV;
  3379. +    }
  3380. +
  3381. +    /*
  3382. +     * Maybe we found one,
  3383. +     * have to check if it is a D-Link DE-600 adapter...
  3384. +     */
  3385. +
  3386. +    /* Get the adapter ethernet address from the ROM */
  3387. +    de600_setup_address(NODE_ADDRESS, RW_ADDR);
  3388. +    for (i = 0; i < ETH_ALEN; i++) {
  3389. +        dev->dev_addr[i] = de600_read_byte(READ_DATA, dev);
  3390. +        dev->broadcast[i] = 0xff;
  3391. +    }
  3392. +
  3393. +    /* Check magic code */
  3394. +    if ((dev->dev_addr[1] == 0xde) && (dev->dev_addr[2] == 0x15)) {
  3395. +        /* OK, install real address */
  3396. +        dev->dev_addr[0] = 0x00;
  3397. +        dev->dev_addr[1] = 0x80;
  3398. +        dev->dev_addr[2] = 0xc8;
  3399. +        dev->dev_addr[3] &= 0x0f;
  3400. +        dev->dev_addr[3] |= 0x70;
  3401. +    } else {
  3402. +        printk(" not identified in the printer port\n");
  3403. +        return ENODEV;
  3404. +    }
  3405. +
  3406. +    printk(", Ethernet Address: %2.2X", dev->dev_addr[0]);
  3407. +    for (i = 1; i < ETH_ALEN; i++)
  3408. +        printk(":%2.2X",dev->dev_addr[i]);
  3409. +    printk("\n");
  3410. +
  3411. +    /* Initialize the device structure. */
  3412. +    /*dev->priv = kmalloc(sizeof(struct netstats), GFP_KERNEL);*/
  3413. +    dev->priv = &de600_netstats;
  3414. +
  3415. +    memset(dev->priv, 0, sizeof(struct netstats));
  3416. +    dev->get_stats = get_stats;
  3417. +
  3418. +    dev->open = de600_open;
  3419. +    dev->stop = de600_close;
  3420. +    dev->hard_start_xmit = &de600_start_xmit;
  3421. +
  3422. +    ether_setup(dev);
  3423. +    
  3424. +    select_prn();
  3425. +    return 0;
  3426. +}
  3427. +
  3428. +static void
  3429. +adapter_init(struct device *dev)
  3430. +{
  3431. +    int    i;
  3432. +
  3433. +    cli();
  3434. +    dev->tbusy = 0;        /* Transmit busy...  */
  3435. +    dev->interrupt = 0;
  3436. +    dev->start = 1;
  3437. +
  3438. +    select_nic();
  3439. +    rx_page = 0; /* used by RESET */
  3440. +    de600_put_command(RESET);
  3441. +    de600_put_command(STOP_RESET);
  3442. +
  3443. +    tx_fifo_in = 0;
  3444. +    tx_fifo_out = 0;
  3445. +    free_tx_pages = TX_PAGES;
  3446. +
  3447. +    /* set the ether address. */
  3448. +    de600_setup_address(NODE_ADDRESS, RW_ADDR);
  3449. +    for (i = 0; i < ETH_ALEN; i++)
  3450. +        de600_put_byte(dev->dev_addr[i]);
  3451. +
  3452. +    /* where to start saving incoming packets */
  3453. +    rx_page = RX_BP | RX_BASE_PAGE;
  3454. +    de600_setup_address(MEM_4K, RW_ADDR);
  3455. +    /* Enable receiver */
  3456. +    de600_put_command(RX_ENABLE);
  3457. +    select_prn();
  3458. +    sti();
  3459. +}
  3460. +
  3461. +#if 0
  3462. +/*
  3463. + *    The new router code (coming soon 8-) ) will fix this properly.
  3464. + */
  3465. +#define DE600_MIN_WINDOW 1024
  3466. +#define DE600_MAX_WINDOW 2048
  3467. +#define DE600_TCP_WINDOW_DIFF 1024
  3468. +/*
  3469. + * Copied from sock.c
  3470. + *
  3471. + * Sets a lower max receive window in order to achieve <= 2
  3472. + * packets arriving at the adapter in fast succession.
  3473. + * (No way that a DE-600 can cope with an ethernet saturated with its packets :-)
  3474. + *
  3475. + * Since there are only 2 receive buffers in the DE-600
  3476. + * and it takes some time to copy from the adapter,
  3477. + * this is absolutely necessary for any TCP performance whatsoever!
  3478. + *
  3479. + */
  3480. +#define min(a,b)    ((a)<(b)?(a):(b))
  3481. +static unsigned long
  3482. +de600_rspace(struct sock *sk)
  3483. +{
  3484. +  int amt;
  3485. +
  3486. +  if (sk != NULL) {
  3487. +/*
  3488. + * Hack! You might want to play with commenting away the following line,
  3489. + * if you know what you do!
  3490. + */
  3491. +      sk->max_unacked = DE600_MAX_WINDOW - DE600_TCP_WINDOW_DIFF;
  3492. +
  3493. +    if (sk->rmem_alloc >= SK_RMEM_MAX-2*DE600_MIN_WINDOW) return(0);
  3494. +    amt = min((SK_RMEM_MAX-sk->rmem_alloc)/2-DE600_MIN_WINDOW, DE600_MAX_WINDOW);
  3495. +    if (amt < 0) return(0);
  3496. +    return(amt);
  3497. +  }
  3498. +  return(0);
  3499. +}
  3500. +#endif
  3501. +
  3502. +#ifdef MODULE
  3503. +char kernel_version[] = UTS_RELEASE;
  3504. +static struct device de600_dev = {
  3505. +    "" /*"de600"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, de600_probe };
  3506. +
  3507. +int
  3508. +init_module(void)
  3509. +{
  3510. +    if (register_netdev(&de600_dev) != 0)
  3511. +        return -EIO;
  3512. +    return 0;
  3513. +}
  3514. +
  3515. +void
  3516. +cleanup_module(void)
  3517. +{
  3518. +    if (MOD_IN_USE)
  3519. +        printk("de600: device busy, remove delayed\n");
  3520. +    else
  3521. +        unregister_netdev(&de600_dev);
  3522. +}
  3523. +#endif /* MODULE */
  3524. Only in linux.old/drivers/net: depca.c.orig
  3525. Only in linux.old/drivers/net: depca.h.orig
  3526. diff -u --new-file --recursive linux.old/drivers/net/eexpress.c linux/drivers/net/eexpress.c
  3527. --- linux.old/drivers/net/eexpress.c    Fri May 20 18:42:29 1994
  3528. +++ linux/drivers/net/eexpress.c    Fri May 20 18:51:11 1994
  3529. @@ -545,7 +545,7 @@
  3530.              lp->stats.tx_packets++;
  3531.              lp->stats.collisions += tx_status & 0xf;
  3532.              dev->tbusy = 0;
  3533. -            mark_bh(INET_BH);    /* Inform upper layers. */
  3534. +            mark_bh(NET_BH);    /* Inform upper layers. */
  3535.          } else {
  3536.              lp->stats.tx_errors++;
  3537.              if (tx_status & 0x0600)  lp->stats.tx_carrier_errors++;
  3538. Only in linux.old/drivers/net: eexpress.c.ori
  3539. Only in linux.old/drivers/net: hp.c.orig
  3540. diff -u --new-file --recursive linux.old/drivers/net/lance.c linux/drivers/net/lance.c
  3541. --- linux.old/drivers/net/lance.c    Fri May 20 18:42:30 1994
  3542. +++ linux/drivers/net/lance.c    Fri May 20 18:57:29 1994
  3543. @@ -196,6 +196,7 @@
  3544.      int dma;
  3545.      struct enet_statistics stats;
  3546.      char old_lance;
  3547. +    char lock;
  3548.      int pad0, pad1;        /* Used for alignment */
  3549.  };
  3550.  
  3551. @@ -434,6 +435,7 @@
  3552.      struct lance_private *lp = (struct lance_private *)dev->priv;
  3553.      int i;
  3554.  
  3555. +    lp->lock = 0;
  3556.      lp->cur_rx = lp->cur_tx = 0;
  3557.      lp->dirty_rx = lp->dirty_tx = 0;
  3558.  
  3559. @@ -515,8 +517,17 @@
  3560.  
  3561.      /* Block a timer-based transmit from overlapping.  This could better be
  3562.         done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */
  3563. -    if (set_bit(0, (void*)&dev->tbusy) != 0)
  3564. +    if (set_bit(0, (void*)&dev->tbusy) != 0) {
  3565.      printk("%s: Transmitter access conflict.\n", dev->name);
  3566. +    return 1;
  3567. +    }
  3568. +
  3569. +    if (set_bit(0, (void*)&lp->lock) != 0) {
  3570. +        if (lance_debug > 2)
  3571. +        printk("%s: tx queue lock!.\n", dev->name);
  3572. +    /* don't clear dev->tbusy flag. */
  3573. +        return 1;
  3574. +    }
  3575.  
  3576.      /* Fill in a Tx ring entry */
  3577.  
  3578. @@ -549,8 +560,9 @@
  3579.      } else {
  3580.          /* We can't free the packet yet, so we inform the memory management
  3581.         code that we are still using it. */
  3582. -        if(skb->free==0)
  3583. -            skb_kept_by_device(skb);
  3584. +
  3585. +        skb_kept_by_device(skb);
  3586. +
  3587.      lp->tx_ring[entry].base = (int)(skb->data) | 0x83000000;
  3588.      }
  3589.      lp->cur_tx++;
  3590. @@ -561,8 +573,11 @@
  3591.  
  3592.      dev->trans_start = jiffies;
  3593.  
  3594. +    cli();
  3595. +    lp->lock = 0;
  3596.      if (lp->tx_ring[(entry+1) & TX_RING_MOD_MASK].base == 0)
  3597.      dev->tbusy=0;
  3598. +    sti();
  3599.  
  3600.      return 0;
  3601.  }
  3602. @@ -635,10 +650,8 @@
  3603.          if (databuff >= (void*)(&lp->tx_bounce_buffs[TX_RING_SIZE])
  3604.          || databuff < (void*)(lp->tx_bounce_buffs)) {
  3605.          struct sk_buff *skb = ((struct sk_buff *)databuff) - 1;
  3606. -        if (skb->free)
  3607. -            kfree_skb(skb, FREE_WRITE);
  3608. -        else
  3609. -            skb_device_release(skb,FREE_WRITE);
  3610. +        skb_device_release(skb,FREE_WRITE);
  3611. +
  3612.          /* Warning: skb may well vanish at the point you call
  3613.             device_release! */
  3614.          }
  3615. @@ -656,7 +669,7 @@
  3616.      if (dev->tbusy  &&  dirty_tx > lp->cur_tx - TX_RING_SIZE + 2) {
  3617.          /* The ring is no longer full, clear tbusy. */
  3618.          dev->tbusy = 0;
  3619. -        mark_bh(INET_BH);
  3620. +        mark_bh(NET_BH);
  3621.      }
  3622.  
  3623.      lp->dirty_tx = dirty_tx;
  3624. @@ -685,6 +698,7 @@
  3625.  {
  3626.      struct lance_private *lp = (struct lance_private *)dev->priv;
  3627.      int entry = lp->cur_rx & RX_RING_MOD_MASK;
  3628. +    int i;
  3629.      
  3630.      /* If we own the next entry, it's a new packet. Send it up. */
  3631.      while (lp->rx_ring[entry].base >= 0) {
  3632. @@ -701,6 +715,7 @@
  3633.          if (status & 0x10) lp->stats.rx_over_errors++;
  3634.          if (status & 0x08) lp->stats.rx_crc_errors++;
  3635.          if (status & 0x04) lp->stats.rx_fifo_errors++;
  3636. +        lp->rx_ring[entry].base &= 0x03ffffff;
  3637.      } else {
  3638.          /* Malloc up new buffer, compatible with net-2e. */
  3639.          short pkt_len = lp->rx_ring[entry].msg_length;
  3640. @@ -709,7 +724,15 @@
  3641.          skb = alloc_skb(pkt_len, GFP_ATOMIC);
  3642.          if (skb == NULL) {
  3643.          printk("%s: Memory squeeze, deferring packet.\n", dev->name);
  3644. -        lp->stats.rx_dropped++;    /* Really, deferred. */
  3645. +        for (i=0; i < RX_RING_SIZE; i++)
  3646. +          if (lp->rx_ring[(entry+i) & RX_RING_MOD_MASK].base < 0)
  3647. +            break;
  3648. +
  3649. +        if (i > RX_RING_SIZE -2) {
  3650. +          lp->stats.rx_dropped++;
  3651. +          lp->rx_ring[entry].base |= 0x80000000;
  3652. +          lp->cur_rx++;
  3653. +        }
  3654.          break;
  3655.          }
  3656.          skb->len = pkt_len;
  3657. Only in linux.old/drivers/net: lance.c.orig
  3658. diff -u --new-file --recursive linux.old/drivers/net/lance.c~ linux/drivers/net/lance.c~
  3659. --- linux.old/drivers/net/lance.c~    Thu Jan  1 01:00:00 1970
  3660. +++ linux/drivers/net/lance.c~    Fri May 20 18:57:29 1994
  3661. @@ -0,0 +1,851 @@
  3662. +#define LANCE_DMA 3
  3663. +/* lance.c: An AMD LANCE ethernet driver for linux. */
  3664. +/*
  3665. +    Written 1993 by Donald Becker.
  3666. +
  3667. +    Copyright 1993 United States Government as represented by the
  3668. +    Director, National Security Agency.  This software may be used and
  3669. +    distributed according to the terms of the GNU Public License,
  3670. +    incorporated herein by reference.
  3671. +
  3672. +    This driver is for the Allied Telesis AT1500 and HP J2405A, and should work
  3673. +    with most other LANCE-based bus-master (NE2100 clone) ethercards.
  3674. +
  3675. +    The author may be reached as becker@super.org or
  3676. +    C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
  3677. +*/
  3678. +
  3679. +static char *version = "lance.c:v0.14g 12/21/93 becker@super.org\n";
  3680. +
  3681. +#include <linux/config.h>
  3682. +#include <linux/kernel.h>
  3683. +#include <linux/sched.h>
  3684. +#include <linux/string.h>
  3685. +#include <linux/ptrace.h>
  3686. +#include <linux/errno.h>
  3687. +#include <linux/ioport.h>
  3688. +#include <linux/malloc.h>
  3689. +#include <linux/interrupt.h>
  3690. +#include <asm/bitops.h>
  3691. +#include <asm/io.h>
  3692. +#include <asm/dma.h>
  3693. +
  3694. +#include <linux/netdevice.h>
  3695. +#include <linux/etherdevice.h>
  3696. +#include <linux/skbuff.h>
  3697. +
  3698. +#ifndef HAVE_PORTRESERVE
  3699. +#define check_region(addr, size)    0
  3700. +#define snarf_region(addr, size)    do ; while(0)
  3701. +#endif
  3702. +
  3703. +struct device *init_etherdev(struct device *dev, int sizeof_private,
  3704. +                 unsigned long *mem_startp);
  3705. +
  3706. +#ifdef LANCE_DEBUG
  3707. +int lance_debug = LANCE_DEBUG;
  3708. +#else
  3709. +int lance_debug = 1;
  3710. +#endif
  3711. +
  3712. +#ifndef LANCE_DMA
  3713. +#define LANCE_DMA    5
  3714. +#endif
  3715. +
  3716. +/*
  3717. +          Theory of Operation
  3718. +
  3719. +I. Board Compatibility
  3720. +
  3721. +This device driver is designed for the AMD 79C960, the "PCnet-ISA
  3722. +single-chip ethernet controller for ISA".  This chip is used in a wide
  3723. +variety of boards from vendors such as Allied Telesis, HP, Kingston,
  3724. +and Boca.  This driver is also intended to work with older AMD 7990
  3725. +designs, such as the NE1500 and NE2100.  For convenience, I use the name
  3726. +LANCE to refer to either AMD chip.
  3727. +
  3728. +II. Board-specific settings
  3729. +
  3730. +The driver is designed to work the boards that use the faster
  3731. +bus-master mode, rather than in shared memory mode.  (Only older designs
  3732. +have on-board buffer memory needed to support the slower shared memory mode.)
  3733. +
  3734. +Most boards have jumpered settings for the I/O base, IRQ line, and DMA channel.
  3735. +This driver probes the likely base addresses, {0x300, 0x320, 0x340, 0x360}.
  3736. +After the board is found it generates an DMA-timeout interrupt and uses
  3737. +autoIRQ to find the IRQ line.  The DMA channel defaults to LANCE_DMA, or it
  3738. +can be set with the low bits of the otherwise-unused dev->mem_start value.
  3739. +
  3740. +The HP-J2405A board is an exception: with this board it's easy to read the
  3741. +EEPROM-set values for the base, IRQ, and DMA.  Of course you must already
  3742. +_know_ the base address, but that entry is for changing the EEPROM.
  3743. +
  3744. +III. Driver operation
  3745. +
  3746. +IIIa. Ring buffers
  3747. +The LANCE uses ring buffers of Tx and Rx descriptors.  Each entry describes
  3748. +the base and length of the data buffer, along with status bits.  The length
  3749. +of these buffers is set by LANCE_LOG_{RX,TX}_BUFFERS, which is log_2() of
  3750. +the buffer length (rather than being directly the buffer length) for
  3751. +implementation ease.  The current values are 2 (Tx) and 4 (Rx), which leads to
  3752. +ring sizes of 4 (Tx) and 16 (Rx).  Increasing the number of ring entries
  3753. +needlessly uses extra space and reduces the chance that an upper layer will
  3754. +be able to reorder queued Tx packets based on priority.  Decreasing the number
  3755. +of entries makes it more difficult to achieve back-to-back packet transmission
  3756. +and increases the chance that Rx ring will overflow.  (Consider the worst case
  3757. +of receiving back-to-back minimum-sized packets.)
  3758. +
  3759. +The LANCE has the capability to "chain" both Rx and Tx buffers, but this driver
  3760. +statically allocates full-sized (slightly oversized -- PKT_BUF_SZ) buffers to
  3761. +avoid the administrative overhead. For the Rx side this avoids dynamically
  3762. +allocating full-sized buffers "just in case", at the expense of a
  3763. +memory-to-memory data copy for each packet received.  For most systems this
  3764. +is an good tradeoff: the Rx buffer will always be in low memory, the copy
  3765. +is inexpensive, and it primes the cache for later packet processing.  For Tx
  3766. +the buffers are only used when needed as low-memory bounce buffers.
  3767. +
  3768. +IIIB. 16M memory limitations.
  3769. +For the ISA bus master mode all structures used directly by the LANCE,
  3770. +the initialization block, Rx and Tx rings, and data buffers, must be
  3771. +accessable from the ISA bus, i.e. in the lower 16M of real memory.
  3772. +This is a problem for current Linux kernels on >16M machines. The network
  3773. +devices are initialized after memory initialization, and the kernel doles out
  3774. +memory from the top of memory downward.  The current solution is to have a
  3775. +special network initialization routine that's called before memory
  3776. +initialization; this will eventually be generalized for all network devices.
  3777. +As mentioned before, low-memory "bounce-buffers" are used when needed.
  3778. +
  3779. +IIIC. Synchronization
  3780. +The driver runs as two independent, single-threaded flows of control.  One
  3781. +is the send-packet routine, which enforces single-threaded use by the
  3782. +dev->tbusy flag.  The other thread is the interrupt handler, which is single
  3783. +threaded by the hardware and other software.
  3784. +
  3785. +The send packet thread has partial control over the Tx ring and 'dev->tbusy'
  3786. +flag.  It sets the tbusy flag whenever it's queuing a Tx packet. If the next
  3787. +queue slot is empty, it clears the tbusy flag when finished otherwise it sets
  3788. +the 'lp->tx_full' flag.
  3789. +
  3790. +The interrupt handler has exclusive control over the Rx ring and records stats
  3791. +from the Tx ring.  (The Tx-done interrupt can't be selectively turned off, so
  3792. +we can't avoid the interrupt overhead by having the Tx routine reap the Tx
  3793. +stats.)  After reaping the stats, it marks the queue entry as empty by setting
  3794. +the 'base' to zero.  Iff the 'lp->tx_full' flag is set, it clears both the
  3795. +tx_full and tbusy flags.
  3796. +
  3797. +*/
  3798. +
  3799. +/* Set the number of Tx and Rx buffers, using Log_2(# buffers).
  3800. +   Reasonable default values are 4 Tx buffers, and 16 Rx buffers.
  3801. +   That translates to 2 (4 == 2^^2) and 4 (16 == 2^^4). */
  3802. +#ifndef LANCE_LOG_TX_BUFFERS
  3803. +#define LANCE_LOG_TX_BUFFERS 4
  3804. +#define LANCE_LOG_RX_BUFFERS 4
  3805. +#endif
  3806. +
  3807. +#define TX_RING_SIZE        (1 << (LANCE_LOG_TX_BUFFERS))
  3808. +#define TX_RING_MOD_MASK    (TX_RING_SIZE - 1)
  3809. +#define TX_RING_LEN_BITS    ((LANCE_LOG_TX_BUFFERS) << 29)
  3810. +
  3811. +#define RX_RING_SIZE        (1 << (LANCE_LOG_RX_BUFFERS))
  3812. +#define RX_RING_MOD_MASK    (RX_RING_SIZE - 1)
  3813. +#define RX_RING_LEN_BITS    ((LANCE_LOG_RX_BUFFERS) << 29)
  3814. +
  3815. +#define PKT_BUF_SZ    1544
  3816. +
  3817. +/* Offsets from base I/O address. */
  3818. +#define LANCE_DATA 0x10
  3819. +#define LANCE_ADDR 0x12
  3820. +#define LANCE_RESET 0x14
  3821. +#define LANCE_BUS_IF 0x16
  3822. +#define LANCE_TOTAL_SIZE 0x18
  3823. +
  3824. +/* The LANCE Rx and Tx ring descriptors. */
  3825. +struct lance_rx_head {
  3826. +    int    base;
  3827. +    short buf_length;        /* This length is 2's complement (negative)! */
  3828. +    short msg_length;        /* This length is "normal". */
  3829. +};
  3830. +
  3831. +struct lance_tx_head {
  3832. +    int      base;
  3833. +    short length;        /* Length is 2's complement (negative)! */
  3834. +    short misc;
  3835. +};
  3836. +
  3837. +/* The LANCE initialization block, described in databook. */
  3838. +struct lance_init_block {
  3839. +    unsigned short mode;    /* Pre-set mode (reg. 15) */
  3840. +    unsigned char phys_addr[6];    /* Physical ethernet address */
  3841. +    unsigned filter[2];        /* Multicast filter (unused). */
  3842. +    /* Receive and transmit ring base, along with extra bits. */
  3843. +    unsigned rx_ring;        /* Tx and Rx ring base pointers */
  3844. +    unsigned tx_ring;
  3845. +};
  3846. +
  3847. +struct lance_private {
  3848. +    char devname[8];
  3849. +    /* These must aligned on 8-byte boundaries. */
  3850. +    struct lance_rx_head rx_ring[RX_RING_SIZE];
  3851. +    struct lance_tx_head tx_ring[TX_RING_SIZE];
  3852. +    struct lance_init_block    init_block;
  3853. +    long rx_buffs;        /* Address of Rx and Tx buffers. */
  3854. +    /* Tx low-memory "bounce buffer" address. */
  3855. +    char (*tx_bounce_buffs)[PKT_BUF_SZ];
  3856. +    int    cur_rx, cur_tx;        /* The next free ring entry */
  3857. +    int dirty_rx, dirty_tx;    /* The ring entries to be free()ed. */
  3858. +    int dma;
  3859. +    struct enet_statistics stats;
  3860. +    char old_lance;
  3861. +    char lock;
  3862. +    int pad0, pad1;        /* Used for alignment */
  3863. +};
  3864. +
  3865. +unsigned long lance_probe1(short ioaddr, unsigned long mem_start);
  3866. +static int lance_open(struct device *dev);
  3867. +static void lance_init_ring(struct device *dev);
  3868. +static int lance_start_xmit(struct sk_buff *skb, struct device *dev);
  3869. +static int lance_rx(struct device *dev);
  3870. +static void lance_interrupt(int reg_ptr);
  3871. +static int lance_close(struct device *dev);
  3872. +static struct enet_statistics *lance_get_stats(struct device *dev);
  3873. +#ifdef HAVE_MULTICAST
  3874. +static void set_multicast_list(struct device *dev, int num_addrs, void *addrs);
  3875. +#endif
  3876. +
  3877. +
  3878. +
  3879. +unsigned long lance_init(unsigned long mem_start, unsigned long mem_end)
  3880. +{
  3881. +    int *port, ports[] = {0x300, 0x320, 0x340, 0x360, 0};
  3882. +
  3883. +    for (port = &ports[0]; *port; port++) {
  3884. +    int ioaddr = *port;
  3885. +
  3886. +    if (   check_region(ioaddr, LANCE_TOTAL_SIZE) == 0
  3887. +        && inb(ioaddr + 14) == 0x57
  3888. +        && inb(ioaddr + 15) == 0x57) {
  3889. +        mem_start = lance_probe1(ioaddr, mem_start);
  3890. +    }
  3891. +    }
  3892. +
  3893. +    return mem_start;
  3894. +}
  3895. +
  3896. +unsigned long lance_probe1(short ioaddr, unsigned long mem_start)
  3897. +{
  3898. +    struct device *dev;
  3899. +    struct lance_private *lp;
  3900. +    int hpJ2405A = 0;
  3901. +    int i, reset_val;
  3902. +
  3903. +    hpJ2405A = (inb(ioaddr) == 0x08 && inb(ioaddr+1) == 0x00
  3904. +        && inb(ioaddr+2) == 0x09);
  3905. +
  3906. +    /* Reset the LANCE.  */
  3907. +    reset_val = inw(ioaddr+LANCE_RESET); /* Reset the LANCE */
  3908. +
  3909. +    /* The Un-Reset needed is only needed for the real NE2100, and will
  3910. +       confuse the HP board. */
  3911. +    if (!hpJ2405A)
  3912. +    outw(reset_val, ioaddr+LANCE_RESET);
  3913. +
  3914. +    outw(0x0000, ioaddr+LANCE_ADDR); /* Switch to window 0 */
  3915. +    if (inw(ioaddr+LANCE_DATA) != 0x0004)
  3916. +    return mem_start;
  3917. +
  3918. +    dev = init_etherdev(0, sizeof(struct lance_private)
  3919. +            + PKT_BUF_SZ*(RX_RING_SIZE + TX_RING_SIZE),
  3920. +            &mem_start);
  3921. +
  3922. +    printk("%s: LANCE at %#3x,", dev->name, ioaddr);
  3923. +
  3924. +    /* There is a 16 byte station address PROM at the base address.
  3925. +       The first six bytes are the station address. */
  3926. +    for (i = 0; i < 6; i++)
  3927. +    printk(" %2.2x", dev->dev_addr[i] = inb(ioaddr + i));
  3928. +
  3929. +    dev->base_addr = ioaddr;
  3930. +    snarf_region(ioaddr, LANCE_TOTAL_SIZE);
  3931. +
  3932. +    /* Make certain the data structures used by the LANCE are aligned. */
  3933. +    dev->priv = (void *)(((int)dev->priv + 7) & ~7);
  3934. +    lp = (struct lance_private *)dev->priv;
  3935. +    lp->rx_buffs = (long)dev->priv + sizeof(struct lance_private);
  3936. +    lp->tx_bounce_buffs = (char (*)[PKT_BUF_SZ])
  3937. +               (lp->rx_buffs + PKT_BUF_SZ*RX_RING_SIZE);
  3938. +
  3939. +#ifndef final_version
  3940. +    /* This should never happen. */
  3941. +    if ((int)(lp->rx_ring) & 0x07) {
  3942. +    printk(" **ERROR** LANCE Rx and Tx rings not on even boundary.\n");
  3943. +    return mem_start;
  3944. +    }
  3945. +#endif
  3946. +
  3947. +    outw(88, ioaddr+LANCE_ADDR);
  3948. +    lp->old_lance = (inw(ioaddr+LANCE_DATA) != 0x3003);
  3949. +
  3950. +#if defined(notdef)
  3951. +    printk(lp->old_lance ? " original LANCE (%04x)" : " PCnet-ISA LANCE (%04x)",
  3952. +       inw(ioaddr+LANCE_DATA));
  3953. +#endif
  3954. +
  3955. +    lp->init_block.mode = 0x0003;    /* Disable Rx and Tx. */
  3956. +    for (i = 0; i < 6; i++)
  3957. +    lp->init_block.phys_addr[i] = dev->dev_addr[i];
  3958. +    lp->init_block.filter[0] = 0x00000000;
  3959. +    lp->init_block.filter[1] = 0x00000000;
  3960. +    lp->init_block.rx_ring = (int)lp->rx_ring | RX_RING_LEN_BITS;
  3961. +    lp->init_block.tx_ring = (int)lp->tx_ring | TX_RING_LEN_BITS;
  3962. +
  3963. +    outw(0x0001, ioaddr+LANCE_ADDR);
  3964. +    outw((short) (int) &lp->init_block, ioaddr+LANCE_DATA);
  3965. +    outw(0x0002, ioaddr+LANCE_ADDR);
  3966. +    outw(((int)&lp->init_block) >> 16, ioaddr+LANCE_DATA);
  3967. +    outw(0x0000, ioaddr+LANCE_ADDR);
  3968. +
  3969. +    if (hpJ2405A) {
  3970. +    char dma_tbl[4] = {3, 5, 6, 7};
  3971. +    char irq_tbl[8] = {3, 4, 5, 9, 10, 11, 12, 15};
  3972. +    short reset_val = inw(ioaddr+LANCE_RESET);
  3973. +    dev->dma = dma_tbl[(reset_val >> 2) & 3];
  3974. +    dev->irq = irq_tbl[(reset_val >> 4) & 7];
  3975. +    printk(" HP J2405A IRQ %d DMA %d.\n", dev->irq, dev->dma);
  3976. +    } else {
  3977. +    /* The DMA channel may be passed in on this parameter. */
  3978. +    if (dev->mem_start & 0x07)
  3979. +        dev->dma = dev->mem_start & 0x07;
  3980. +    else if (dev->dma == 0)
  3981. +        dev->dma = LANCE_DMA;
  3982. +
  3983. +    /* To auto-IRQ we enable the initialization-done and DMA err,
  3984. +       interrupts. For now we will always get a DMA error. */
  3985. +    if (dev->irq < 2) {
  3986. +
  3987. +        autoirq_setup(0);
  3988. +
  3989. +        /* Trigger an initialization just for the interrupt. */
  3990. +        outw(0x0041, ioaddr+LANCE_DATA);
  3991. +
  3992. +        dev->irq = autoirq_report(1);
  3993. +        if (dev->irq)
  3994. +        printk(", probed IRQ %d, fixed at DMA %d.\n",
  3995. +               dev->irq, dev->dma);
  3996. +        else {
  3997. +        printk(", failed to detect IRQ line.\n");
  3998. +        return mem_start;
  3999. +        }
  4000. +    } else
  4001. +        printk(" assigned IRQ %d DMA %d.\n", dev->irq, dev->dma);
  4002. +    }
  4003. +
  4004. +    if (! lp->old_lance) {
  4005. +    /* Turn on auto-select of media (10baseT or BNC) so that the user
  4006. +       can watch the LEDs even if the board isn't opened. */
  4007. +    outw(0x0002, ioaddr+LANCE_ADDR);
  4008. +    outw(0x0002, ioaddr+LANCE_BUS_IF);
  4009. +    }
  4010. +
  4011. +    if (lance_debug > 0)
  4012. +    printk(version);
  4013. +
  4014. +    /* The LANCE-specific entries in the device structure. */
  4015. +    dev->open = &lance_open;
  4016. +    dev->hard_start_xmit = &lance_start_xmit;
  4017. +    dev->stop = &lance_close;
  4018. +    dev->get_stats = &lance_get_stats;
  4019. +    dev->set_multicast_list = &set_multicast_list;
  4020. +
  4021. +    return mem_start;
  4022. +}
  4023. +
  4024. +
  4025. +static int
  4026. +lance_open(struct device *dev)
  4027. +{
  4028. +    struct lance_private *lp = (struct lance_private *)dev->priv;
  4029. +    int ioaddr = dev->base_addr;
  4030. +    int i;
  4031. +
  4032. +    if (request_irq(dev->irq, &lance_interrupt)) {
  4033. +    return -EAGAIN;
  4034. +    }
  4035. +
  4036. +    if (request_dma(dev->dma)) {
  4037. +    free_irq(dev->irq);
  4038. +    return -EAGAIN;
  4039. +    }
  4040. +    irq2dev_map[dev->irq] = dev;
  4041. +
  4042. +    /* Reset the LANCE */
  4043. +    inw(ioaddr+LANCE_RESET);
  4044. +
  4045. +    /* The DMA controller is used as a no-operation slave, "cascade mode". */
  4046. +    enable_dma(dev->dma);
  4047. +    set_dma_mode(dev->dma, DMA_MODE_CASCADE);
  4048. +
  4049. +    /* Un-Reset the LANCE, needed only for the NE2100. */
  4050. +    if (lp->old_lance)
  4051. +    outw(0, ioaddr+LANCE_RESET);
  4052. +
  4053. +    if (! lp->old_lance) {
  4054. +    /* This is 79C960-specific: Turn on auto-select of media (AUI, BNC). */
  4055. +    outw(0x0002, ioaddr+LANCE_ADDR);
  4056. +    outw(0x0002, ioaddr+LANCE_BUS_IF);
  4057. +    }
  4058. +
  4059. +    if (lance_debug > 1)
  4060. +    printk("%s: lance_open() irq %d dma %d tx/rx rings %#x/%#x init %#x.\n",
  4061. +           dev->name, dev->irq, dev->dma, (int) lp->tx_ring, (int) lp->rx_ring,
  4062. +           (int) &lp->init_block);
  4063. +
  4064. +    lance_init_ring(dev);
  4065. +    /* Re-initialize the LANCE, and start it when done. */
  4066. +    outw(0x0001, ioaddr+LANCE_ADDR);
  4067. +    outw((short) (int) &lp->init_block, ioaddr+LANCE_DATA);
  4068. +    outw(0x0002, ioaddr+LANCE_ADDR);
  4069. +    outw(((int)&lp->init_block) >> 16, ioaddr+LANCE_DATA);
  4070. +
  4071. +    outw(0x0004, ioaddr+LANCE_ADDR);
  4072. +    outw(0x0d15, ioaddr+LANCE_DATA);
  4073. +
  4074. +    outw(0x0000, ioaddr+LANCE_ADDR);
  4075. +    outw(0x0001, ioaddr+LANCE_DATA);
  4076. +
  4077. +    dev->tbusy = 0;
  4078. +    dev->interrupt = 0;
  4079. +    dev->start = 1;
  4080. +    i = 0;
  4081. +    while (i++ < 100)
  4082. +    if (inw(ioaddr+LANCE_DATA) & 0x0100)
  4083. +        break;
  4084. +    outw(0x0142, ioaddr+LANCE_DATA);
  4085. +
  4086. +    if (lance_debug > 2)
  4087. +    printk("%s: LANCE open after %d ticks, init block %#x csr0 %4.4x.\n",
  4088. +           dev->name, i, (int) &lp->init_block, inw(ioaddr+LANCE_DATA));
  4089. +
  4090. +    return 0;            /* Always succeed */
  4091. +}
  4092. +
  4093. +/* Initialize the LANCE Rx and Tx rings. */
  4094. +static void
  4095. +lance_init_ring(struct device *dev)
  4096. +{
  4097. +    struct lance_private *lp = (struct lance_private *)dev->priv;
  4098. +    int i;
  4099. +
  4100. +    lp->lock = 0;
  4101. +    lp->cur_rx = lp->cur_tx = 0;
  4102. +    lp->dirty_rx = lp->dirty_tx = 0;
  4103. +
  4104. +    for (i = 0; i < RX_RING_SIZE; i++) {
  4105. +    lp->rx_ring[i].base = (lp->rx_buffs + i*PKT_BUF_SZ) | 0x80000000;
  4106. +    lp->rx_ring[i].buf_length = -PKT_BUF_SZ;
  4107. +    }
  4108. +    /* The Tx buffer address is filled in as needed, but we do need to clear
  4109. +       the upper ownership bit. */
  4110. +    for (i = 0; i < TX_RING_SIZE; i++) {
  4111. +    lp->tx_ring[i].base = 0;
  4112. +    }
  4113. +
  4114. +    lp->init_block.mode = 0x0000;
  4115. +    for (i = 0; i < 6; i++)
  4116. +    lp->init_block.phys_addr[i] = dev->dev_addr[i];
  4117. +    lp->init_block.filter[0] = 0x00000000;
  4118. +    lp->init_block.filter[1] = 0x00000000;
  4119. +    lp->init_block.rx_ring = (int)lp->rx_ring | RX_RING_LEN_BITS;
  4120. +    lp->init_block.tx_ring = (int)lp->tx_ring | TX_RING_LEN_BITS;
  4121. +}
  4122. +
  4123. +static int
  4124. +lance_start_xmit(struct sk_buff *skb, struct device *dev)
  4125. +{
  4126. +    struct lance_private *lp = (struct lance_private *)dev->priv;
  4127. +    int ioaddr = dev->base_addr;
  4128. +    int entry;
  4129. +
  4130. +    /* Transmitter timeout, serious problems. */
  4131. +    if (dev->tbusy) {
  4132. +    int tickssofar = jiffies - dev->trans_start;
  4133. +    if (tickssofar < 10)
  4134. +        return 1;
  4135. +    outw(0, ioaddr+LANCE_ADDR);
  4136. +    printk("%s: transmit timed out, status %4.4x, resetting.\n",
  4137. +           dev->name, inw(ioaddr+LANCE_DATA));
  4138. +    outw(0x0001, ioaddr+LANCE_DATA);
  4139. +    lp->stats.tx_errors++;
  4140. +#ifndef final_version
  4141. +    {
  4142. +        int i;
  4143. +        printk(" Ring data dump: dirty_tx %d cur_tx %d cur_rx %d.",
  4144. +           lp->dirty_tx, lp->cur_tx, lp->cur_rx);
  4145. +        for (i = 0 ; i < RX_RING_SIZE; i++)
  4146. +        printk("%s %08x %04x %04x", i & 0x3 ? "" : "\n ",
  4147. +               lp->rx_ring[i].base, -lp->rx_ring[i].buf_length,
  4148. +               lp->rx_ring[i].msg_length);
  4149. +        for (i = 0 ; i < TX_RING_SIZE; i++)
  4150. +        printk(" %s%08x %04x %04x", i & 0x3 ? "" : "\n ",
  4151. +               lp->tx_ring[i].base, -lp->tx_ring[i].length,
  4152. +               lp->tx_ring[i].misc);
  4153. +        printk("\n");
  4154. +    }
  4155. +#endif
  4156. +    lance_init_ring(dev);
  4157. +    outw(0x0043, ioaddr+LANCE_DATA);
  4158. +
  4159. +    dev->tbusy=0;
  4160. +    dev->trans_start = jiffies;
  4161. +
  4162. +    return 0;
  4163. +    }
  4164. +
  4165. +    if (skb == NULL) {
  4166. +    dev_tint(dev);
  4167. +    return 0;
  4168. +    }
  4169. +
  4170. +    if (skb->len <= 0)
  4171. +    return 0;
  4172. +
  4173. +    if (lance_debug > 3) {
  4174. +    outw(0x0000, ioaddr+LANCE_ADDR);
  4175. +    printk("%s: lance_start_xmit() called, csr0 %4.4x.\n", dev->name,
  4176. +           inw(ioaddr+LANCE_DATA));
  4177. +    outw(0x0000, ioaddr+LANCE_DATA);
  4178. +    }
  4179. +
  4180. +    /* Block a timer-based transmit from overlapping.  This could better be
  4181. +       done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */
  4182. +    if (set_bit(0, (void*)&dev->tbusy) != 0) {
  4183. +    printk("%s: Transmitter access conflict.\n", dev->name);
  4184. +    return 1;
  4185. +    }
  4186. +
  4187. +    if (set_bit(0, (void*)&lp->lock) != 0) {
  4188. +        if (lance_debug > 2)
  4189. +        printk("%s: tx queue lock!.\n", dev->name);
  4190. +    /* don't clear dev->tbusy flag. */
  4191. +        return 1;
  4192. +    }
  4193. +
  4194. +    /* Fill in a Tx ring entry */
  4195. +
  4196. +    /* Mask to ring buffer boundary. */
  4197. +    entry = lp->cur_tx & TX_RING_MOD_MASK;
  4198. +
  4199. +    /* Caution: the write order is important here, set the base address
  4200. +       with the "ownership" bits last. */
  4201. +
  4202. +    /* The old LANCE chips doesn't automatically pad buffers to min. size. */
  4203. +    if (lp->old_lance) {
  4204. +    lp->tx_ring[entry].length =
  4205. +        -(ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN);
  4206. +    } else
  4207. +    lp->tx_ring[entry].length = -skb->len;
  4208. +
  4209. +    lp->tx_ring[entry].misc = 0x0000;
  4210. +
  4211. +    /* If any part of this buffer is >16M we must copy it to a low-memory
  4212. +       buffer. */
  4213. +    if ((int)(skb->data) + skb->len > 0x01000000) {
  4214. +    if (lance_debug > 5)
  4215. +        printk("%s: bouncing a high-memory packet (%#x).\n",
  4216. +           dev->name, (int)(skb->data));
  4217. +    memcpy(&lp->tx_bounce_buffs[entry], skb->data, skb->len);
  4218. +    lp->tx_ring[entry].base =
  4219. +        (int)(lp->tx_bounce_buffs + entry) | 0x83000000;
  4220. +    if (skb->free)
  4221. +        kfree_skb (skb, FREE_WRITE);
  4222. +    } else {
  4223. +        /* We can't free the packet yet, so we inform the memory management
  4224. +       code that we are still using it. */
  4225. +
  4226. +        skb_kept_by_device(skb);
  4227. +
  4228. +    lp->tx_ring[entry].base = (int)(skb->data) | 0x83000000;
  4229. +    }
  4230. +    lp->cur_tx++;
  4231. +
  4232. +    /* Trigger an immediate send poll. */
  4233. +    outw(0x0000, ioaddr+LANCE_ADDR);
  4234. +    outw(0x0048, ioaddr+LANCE_DATA);
  4235. +
  4236. +    dev->trans_start = jiffies;
  4237. +
  4238. +    cli();
  4239. +    lp->lock = 0;
  4240. +    if (lp->tx_ring[(entry+1) & TX_RING_MOD_MASK].base == 0)
  4241. +    dev->tbusy=0;
  4242. +    sti();
  4243. +
  4244. +    return 0;
  4245. +}
  4246. +
  4247. +/* The LANCE interrupt handler. */
  4248. +static void
  4249. +lance_interrupt(int reg_ptr)
  4250. +{
  4251. +    int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
  4252. +    struct device *dev = (struct device *)(irq2dev_map[irq]);
  4253. +    struct lance_private *lp;
  4254. +    int csr0, ioaddr;
  4255. +
  4256. +    if (dev == NULL) {
  4257. +    printk ("lance_interrupt(): irq %d for unknown device.\n", irq);
  4258. +    return;
  4259. +    }
  4260. +
  4261. +    ioaddr = dev->base_addr;
  4262. +    lp = (struct lance_private *)dev->priv;
  4263. +    if (dev->interrupt)
  4264. +    printk("%s: Re-entering the interrupt handler.\n", dev->name);
  4265. +
  4266. +    dev->interrupt = 1;
  4267. +
  4268. +    outw(0x00, dev->base_addr + LANCE_ADDR);
  4269. +    csr0 = inw(dev->base_addr + LANCE_DATA);
  4270. +
  4271. +    /* Acknowledge all of the current interrupt sources ASAP. */
  4272. +    outw(csr0 & ~0x004f, dev->base_addr + LANCE_DATA);
  4273. +
  4274. +    if (lance_debug > 5)
  4275. +    printk("%s: interrupt  csr0=%#2.2x new csr=%#2.2x.\n",
  4276. +           dev->name, csr0, inw(dev->base_addr + LANCE_DATA));
  4277. +
  4278. +    if (csr0 & 0x0400)        /* Rx interrupt */
  4279. +    lance_rx(dev);
  4280. +
  4281. +    if (csr0 & 0x0200) {    /* Tx-done interrupt */
  4282. +    int dirty_tx = lp->dirty_tx;
  4283. +
  4284. +    while (dirty_tx < lp->cur_tx) {
  4285. +        int entry = dirty_tx & TX_RING_MOD_MASK;
  4286. +        int status = lp->tx_ring[entry].base;
  4287. +        void *databuff;
  4288. +        
  4289. +        if (status < 0)
  4290. +        break;        /* It still hasn't been Txed */
  4291. +
  4292. +        lp->tx_ring[entry].base = 0;
  4293. +        databuff = (void*)(status & 0x00ffffff);
  4294. +
  4295. +        if (status & 0x40000000) { /* There was an major error, log it. */
  4296. +        int err_status = lp->tx_ring[entry].misc;
  4297. +        lp->stats.tx_errors++;
  4298. +        if (err_status & 0x0400) lp->stats.tx_aborted_errors++;
  4299. +        if (err_status & 0x0800) lp->stats.tx_carrier_errors++;
  4300. +        if (err_status & 0x1000) lp->stats.tx_window_errors++;
  4301. +        if (err_status & 0x4000) lp->stats.tx_fifo_errors++;
  4302. +        /* Perhaps we should re-init() after the FIFO error. */
  4303. +        } else {
  4304. +        if (status & 0x18000000)
  4305. +            lp->stats.collisions++;
  4306. +        lp->stats.tx_packets++;
  4307. +        }
  4308. +
  4309. +        /* We don't free the skb if it's a data-only copy in the bounce
  4310. +           buffer.  The address checks here are sorted -- the first test
  4311. +           should always work.  */
  4312. +        if (databuff >= (void*)(&lp->tx_bounce_buffs[TX_RING_SIZE])
  4313. +        || databuff < (void*)(lp->tx_bounce_buffs)) {
  4314. +        struct sk_buff *skb = ((struct sk_buff *)databuff) - 1;
  4315. +        skb_device_release(skb,FREE_WRITE);
  4316. +
  4317. +        /* Warning: skb may well vanish at the point you call
  4318. +           device_release! */
  4319. +        }
  4320. +        dirty_tx++;
  4321. +    }
  4322. +
  4323. +#ifndef final_version
  4324. +    if (lp->cur_tx - dirty_tx >= TX_RING_SIZE) {
  4325. +        printk("out-of-sync dirty pointer, %d vs. %d.\n",
  4326. +           dirty_tx, lp->cur_tx);
  4327. +        dirty_tx += TX_RING_SIZE;
  4328. +    }
  4329. +#endif
  4330. +
  4331. +    if (dev->tbusy  &&  dirty_tx > lp->cur_tx - TX_RING_SIZE + 2) {
  4332. +        /* The ring is no longer full, clear tbusy. */
  4333. +        dev->tbusy = 0;
  4334. +        mark_bh(NET_BH);
  4335. +    }
  4336. +
  4337. +    lp->dirty_tx = dirty_tx;
  4338. +    }
  4339. +
  4340. +    if (csr0 & 0x8000) {
  4341. +    if (csr0 & 0x4000) lp->stats.tx_errors++;
  4342. +    if (csr0 & 0x1000) lp->stats.rx_errors++;
  4343. +    }
  4344. +
  4345. +    /* Clear the interrupts we've handled. */
  4346. +    outw(0x0000, dev->base_addr + LANCE_ADDR);
  4347. +    outw(0x7f40, dev->base_addr + LANCE_DATA);
  4348. +
  4349. +    if (lance_debug > 4)
  4350. +    printk("%s: exiting interrupt, csr%d=%#4.4x.\n",
  4351. +           dev->name, inw(ioaddr + LANCE_ADDR),
  4352. +           inw(dev->base_addr + LANCE_DATA));
  4353. +
  4354. +    dev->interrupt = 0;
  4355. +    return;
  4356. +}
  4357. +
  4358. +static int
  4359. +lance_rx(struct device *dev)
  4360. +{
  4361. +    struct lance_private *lp = (struct lance_private *)dev->priv;
  4362. +    int entry = lp->cur_rx & RX_RING_MOD_MASK;
  4363. +    int i;
  4364. +    
  4365. +    /* If we own the next entry, it's a new packet. Send it up. */
  4366. +    while (lp->rx_ring[entry].base >= 0) {
  4367. +    int status = lp->rx_ring[entry].base >> 24;
  4368. +
  4369. +    if (status != 0x03) {        /* There was an error. */
  4370. +        /* There is an tricky error noted by John Murphy,
  4371. +           <murf@perftech.com> to Russ Nelson: Even with full-sized
  4372. +           buffers it's possible for a jabber packet to use two
  4373. +           buffers, with only the last correctly noting the error. */
  4374. +        if (status & 0x01)    /* Only count a general error at the */
  4375. +        lp->stats.rx_errors++; /* end of a packet.*/
  4376. +        if (status & 0x20) lp->stats.rx_frame_errors++;
  4377. +        if (status & 0x10) lp->stats.rx_over_errors++;
  4378. +        if (status & 0x08) lp->stats.rx_crc_errors++;
  4379. +        if (status & 0x04) lp->stats.rx_fifo_errors++;
  4380. +        lp->rx_ring[entry].base &= 0x03ffffff;
  4381. +    } else {
  4382. +        /* Malloc up new buffer, compatible with net-2e. */
  4383. +        short pkt_len = lp->rx_ring[entry].msg_length;
  4384. +        struct sk_buff *skb;
  4385. +
  4386. +        skb = alloc_skb(pkt_len, GFP_ATOMIC);
  4387. +        if (skb == NULL) {
  4388. +        printk("%s: Memory squeeze, deferring packet.\n", dev->name);
  4389. +        for (i=0; i < RX_RING_SIZE; i++)
  4390. +          if (lp->rx_ring[(entry+i) & RX_RING_MOD_MASK].base < 0)
  4391. +            break;
  4392. +
  4393. +        if (i > RX_RING_SIZE -2) {
  4394. +          lp->stats.rx_dropped++;
  4395. +          lp->rx_ring[entry].base |= 0x80000000;
  4396. +          lp->cur_rx++;
  4397. +        }
  4398. +        break;
  4399. +        }
  4400. +        skb->len = pkt_len;
  4401. +        skb->dev = dev;
  4402. +        memcpy(skb->data,
  4403. +           (unsigned char *)(lp->rx_ring[entry].base & 0x00ffffff),
  4404. +           pkt_len);
  4405. +        netif_rx(skb);
  4406. +        lp->stats.rx_packets++;
  4407. +    }
  4408. +
  4409. +    lp->rx_ring[entry].base |= 0x80000000;
  4410. +    entry = (++lp->cur_rx) & RX_RING_MOD_MASK;
  4411. +    }
  4412. +
  4413. +    /* We should check that at least two ring entries are free.  If not,
  4414. +       we should free one and mark stats->rx_dropped++. */
  4415. +
  4416. +    return 0;
  4417. +}
  4418. +
  4419. +static int
  4420. +lance_close(struct device *dev)
  4421. +{
  4422. +    int ioaddr = dev->base_addr;
  4423. +    struct lance_private *lp = (struct lance_private *)dev->priv;
  4424. +
  4425. +    dev->start = 0;
  4426. +    dev->tbusy = 1;
  4427. +
  4428. +    outw(112, ioaddr+LANCE_ADDR);
  4429. +    lp->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA);
  4430. +
  4431. +    outw(0, ioaddr+LANCE_ADDR);
  4432. +
  4433. +    if (lance_debug > 1)
  4434. +    printk("%s: Shutting down ethercard, status was %2.2x.\n",
  4435. +           dev->name, inw(ioaddr+LANCE_DATA));
  4436. +
  4437. +    /* We stop the LANCE here -- it occasionally polls
  4438. +       memory if we don't. */
  4439. +    outw(0x0004, ioaddr+LANCE_DATA);
  4440. +
  4441. +    disable_dma(dev->dma);
  4442. +
  4443. +    free_irq(dev->irq);
  4444. +    free_dma(dev->dma);
  4445. +
  4446. +    irq2dev_map[dev->irq] = 0;
  4447. +
  4448. +    return 0;
  4449. +}
  4450. +
  4451. +static struct enet_statistics *
  4452. +lance_get_stats(struct device *dev)
  4453. +{
  4454. +    struct lance_private *lp = (struct lance_private *)dev->priv;
  4455. +    short ioaddr = dev->base_addr;
  4456. +    short saved_addr;
  4457. +
  4458. +    cli();
  4459. +    saved_addr = inw(ioaddr+LANCE_ADDR);
  4460. +    outw(112, ioaddr+LANCE_ADDR);
  4461. +    lp->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA);
  4462. +    outw(saved_addr, ioaddr+LANCE_ADDR);
  4463. +    sti();
  4464. +
  4465. +    return &lp->stats;
  4466. +}
  4467. +
  4468. +/* Set or clear the multicast filter for this adaptor.
  4469. +   num_addrs == -1    Promiscuous mode, receive all packets
  4470. +   num_addrs == 0    Normal mode, clear multicast list
  4471. +   num_addrs > 0    Multicast mode, receive normal and MC packets, and do
  4472. +               best-effort filtering.
  4473. + */
  4474. +static void
  4475. +set_multicast_list(struct device *dev, int num_addrs, void *addrs)
  4476. +{
  4477. +    short ioaddr = dev->base_addr;
  4478. +
  4479. +    /* We take the simple way out and always enable promiscuous mode. */
  4480. +    outw(0, ioaddr+LANCE_ADDR);
  4481. +    outw(0x0004, ioaddr+LANCE_DATA); /* Temporarily stop the lance.  */
  4482. +
  4483. +    outw(15, ioaddr+LANCE_ADDR);
  4484. +    if (num_addrs >= 0) {
  4485. +    short multicast_table[4];
  4486. +    int i;
  4487. +    /* We don't use the multicast table, but rely on upper-layer filtering. */
  4488. +    memset(multicast_table, (num_addrs == 0) ? 0 : -1, sizeof(multicast_table));
  4489. +    for (i = 0; i < 4; i++) {
  4490. +        outw(8 + i, ioaddr+LANCE_ADDR);
  4491. +        outw(multicast_table[i], ioaddr+LANCE_DATA);
  4492. +    }
  4493. +    outw(0x0000, ioaddr+LANCE_DATA); /* Unset promiscuous mode */
  4494. +    } else {
  4495. +    outw(0x8000, ioaddr+LANCE_DATA); /* Set promiscuous mode */
  4496. +    }
  4497. +
  4498. +    outw(0, ioaddr+LANCE_ADDR);
  4499. +    outw(0x0142, ioaddr+LANCE_DATA); /* Resume normal operation. */
  4500. +}
  4501. +
  4502. +#ifdef HAVE_DEVLIST
  4503. +static unsigned int lance_portlist[] = {0x300, 0x320, 0x340, 0x360, 0};
  4504. +struct netdev_entry lance_drv =
  4505. +{"lance", lance_probe1, LANCE_TOTAL_SIZE, lance_portlist};
  4506. +#endif
  4507. +
  4508. +/*
  4509. + * Local variables:
  4510. + *  compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c lance.c"
  4511. + * End:
  4512. + */
  4513. diff -u --new-file --recursive linux.old/drivers/net/loopback.c linux/drivers/net/loopback.c
  4514. --- linux.old/drivers/net/loopback.c    Fri May 20 18:43:04 1994
  4515. +++ linux/drivers/net/loopback.c    Fri May 20 18:51:15 1994
  4516. @@ -11,6 +11,8 @@
  4517.   *        Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  4518.   *        Donald Becker, <becker@super.org>
  4519.   *
  4520. + *        Alan Cox    :    Fixed oddments for NET3.014
  4521. + *
  4522.   *        This program is free software; you can redistribute it and/or
  4523.   *        modify it under the terms of the GNU General Public License
  4524.   *        as published by the Free Software Foundation; either version
  4525. @@ -44,7 +46,6 @@
  4526.    struct enet_statistics *stats = (struct enet_statistics *)dev->priv;
  4527.    int done;
  4528.  
  4529. -  DPRINTF((DBG_LOOPB, "loopback_xmit(dev=%X, skb=%X)\n", dev, skb));
  4530.    if (skb == NULL || dev == NULL) return(0);
  4531.  
  4532.    cli();
  4533. @@ -90,6 +91,12 @@
  4534.      return (struct enet_statistics *)dev->priv;
  4535.  }
  4536.  
  4537. +static int loopback_open(struct device *dev)
  4538. +{
  4539. +    dev->flags|=IFF_LOOPBACK;
  4540. +    return 0;
  4541. +}
  4542. +
  4543.  /* Initialize the rest of the LOOPBACK device. */
  4544.  int
  4545.  loopback_init(struct device *dev)
  4546. @@ -107,6 +114,7 @@
  4547.    dev->type        = ARPHRD_ETHER;        /* 0x0001        */
  4548.    dev->type_trans    = eth_type_trans;
  4549.    dev->rebuild_header    = eth_rebuild_header;
  4550. +  dev->open        = loopback_open;
  4551.  #else
  4552.    dev->hard_header_length = 0;
  4553.    dev->addr_len        = 0;
  4554. @@ -119,10 +127,12 @@
  4555.    /* New-style flags. */
  4556.    dev->flags        = IFF_LOOPBACK;
  4557.    dev->family        = AF_INET;
  4558. +#ifdef CONFIG_INET    
  4559.    dev->pa_addr        = in_aton("127.0.0.1");
  4560.    dev->pa_brdaddr    = in_aton("127.255.255.255");
  4561.    dev->pa_mask        = in_aton("255.0.0.0");
  4562.    dev->pa_alen        = sizeof(unsigned long);
  4563. +#endif  
  4564.    dev->priv = kmalloc(sizeof(struct enet_statistics), GFP_KERNEL);
  4565.    memset(dev->priv, 0, sizeof(struct enet_statistics));
  4566.    dev->get_stats = get_stats;
  4567. Only in linux.old/drivers/net: loopback.c.ori
  4568. Only in linux.old/drivers/net: ne.c.orig
  4569. diff -u --new-file --recursive linux.old/drivers/net/net_init.c linux/drivers/net/net_init.c
  4570. --- linux.old/drivers/net/net_init.c    Fri May 20 18:42:31 1994
  4571. +++ linux/drivers/net/net_init.c    Fri May 20 18:51:12 1994
  4572. @@ -14,6 +14,8 @@
  4573.      It's primary advantage is that it's able to allocate low-memory buffers.
  4574.      A secondary advantage is that the dangerous NE*000 netcards can reserve
  4575.      their I/O port region before the SCSI probes start.
  4576. +
  4577. +    register_netdev()/unregister_netdev() by Bjorn Ekwall <bj0rn@blox.se>
  4578.  */
  4579.  
  4580.  #include <linux/config.h>
  4581. @@ -60,7 +62,9 @@
  4582.  #if defined(CONFIG_LANCE)            /* Note this is _not_ CONFIG_AT1500. */
  4583.      mem_start = lance_init(mem_start, mem_end);
  4584.  #endif
  4585. -
  4586. +#if defined(CONFIG_PI)
  4587. +    mem_start = pi_init(mem_start, mem_end);
  4588. +#endif    
  4589.      return mem_start;
  4590.  }
  4591.  
  4592. @@ -161,6 +165,73 @@
  4593.      dev->pa_alen    = sizeof(unsigned long);
  4594.  }
  4595.  
  4596. +int register_netdev(struct device *dev)
  4597. +{
  4598. +    struct device *d = dev_base;
  4599. +    unsigned long flags;
  4600. +    
  4601. +    save_flags(flags);
  4602. +    cli();
  4603. +
  4604. +    if (dev && dev->init) 
  4605. +    {
  4606. +        if (dev->init(dev) != 0)
  4607. +        {
  4608. +            restore_flags(flags);
  4609. +            return -EIO;
  4610. +        }
  4611. +        
  4612. +        if (dev->name  &&  dev->name[0] == '\0')
  4613. +            sprintf(dev->name, "eth%d", next_ethdev_number++);
  4614. +
  4615. +        /* Add device to end of chain */
  4616. +        if (dev_base) 
  4617. +        {
  4618. +            while (d->next)
  4619. +                d = d->next;
  4620. +            d->next = dev;
  4621. +        }
  4622. +        else
  4623. +            dev_base = dev;
  4624. +        dev->next = NULL;
  4625. +    }
  4626. +    restore_flags(flags);
  4627. +    return 0;
  4628. +}
  4629. +
  4630. +void unregister_netdev(struct device *dev)
  4631. +{
  4632. +    struct device *d = dev_base;
  4633. +    unsigned long flags;
  4634. +    
  4635. +    save_flags(flags);
  4636. +    cli();
  4637. +
  4638. +    printk("unregister_netdev: device ");
  4639. +    if (dev) {
  4640. +        if (dev->start)
  4641. +            printk("'%s' busy", dev->name);
  4642. +        else {
  4643. +            if (dev_base == dev)
  4644. +                dev_base = dev->next;
  4645. +            else {
  4646. +                while (d && (d->next != dev))
  4647. +                    d = d->next;
  4648. +
  4649. +                if (d && (d->next == dev)) {
  4650. +                    d->next = dev->next;
  4651. +                    printk("'%s' unlinked", dev->name);
  4652. +                }
  4653. +                else
  4654. +                    printk("'%s' not found", dev->name);
  4655. +            }
  4656. +        }
  4657. +    }
  4658. +    else
  4659. +        printk("was NULL");
  4660. +    printk("\n");
  4661. +    restore_flags(flags);
  4662. +}
  4663.  
  4664.  
  4665.  /*
  4666. Only in linux.old/drivers/net: net_init.c.ori
  4667. diff -u --new-file --recursive linux.old/drivers/net/plip.c linux/drivers/net/plip.c
  4668. --- linux.old/drivers/net/plip.c    Fri May 20 18:42:31 1994
  4669. +++ linux/drivers/net/plip.c    Fri May 20 18:51:09 1994
  4670. @@ -282,7 +282,7 @@
  4671.      if (skb->free)
  4672.      kfree_skb (skb, FREE_WRITE);
  4673.      dev->tbusy = 0;
  4674. -    mark_bh (INET_BH);
  4675. +    mark_bh (NET_BH);
  4676.      return 0/*ret_val*/;
  4677.  }
  4678.  
  4679. Only in linux.old/drivers/net: plip.c.orig
  4680. diff -u --new-file --recursive linux.old/drivers/net/ppp.c linux/drivers/net/ppp.c
  4681. --- linux.old/drivers/net/ppp.c    Sat May 14 14:17:14 1994
  4682. +++ linux/drivers/net/ppp.c    Fri May 20 18:51:17 1994
  4683. @@ -53,17 +53,19 @@
  4684.  #ifdef NET02D                /* v1.1.4 net code and earlier */
  4685.  #include <dev.h>
  4686.  #include <skbuff.h>
  4687. +#include <inet.h>
  4688.  #define    skb_queue_head_init(buf)    *(buf) = NULL
  4689.  #else                    /* v1.1.5 and later */
  4690.  #include <linux/netdevice.h>
  4691.  #include <linux/skbuff.h>
  4692. +#include <linux/inet.h>
  4693.  #endif
  4694.  
  4695.  #include <linux/ppp.h>
  4696.  
  4697.  #include <ip.h>
  4698.  #include <tcp.h>
  4699. -#include <inet.h>
  4700. +
  4701.  #include "slhc.h"
  4702.  
  4703.  #define PRINTK(p) printk p ;
  4704. diff -u --new-file --recursive linux.old/drivers/net/skeleton.c linux/drivers/net/skeleton.c
  4705. --- linux.old/drivers/net/skeleton.c    Fri May 20 18:42:32 1994
  4706. +++ linux/drivers/net/skeleton.c    Fri May 20 18:51:11 1994
  4707. @@ -330,7 +330,7 @@
  4708.          if (status /*& TX_INTR*/) {
  4709.              lp->stats.tx_packets++;
  4710.              dev->tbusy = 0;
  4711. -            mark_bh(INET_BH);    /* Inform upper layers. */
  4712. +            mark_bh(NET_BH);    /* Inform upper layers. */
  4713.          }
  4714.          if (status /*& COUNTERS_INTR*/) {
  4715.              /* Increment the appropriate 'localstats' field. */
  4716. @@ -387,7 +387,7 @@
  4717.      } while (--boguscount);
  4718.  
  4719.      /* If any worth-while packets have been received, dev_rint()
  4720. -       has done a mark_bh(INET_BH) for us and will work on them
  4721. +       has done a mark_bh(NET_BH) for us and will work on them
  4722.         when we get to the bottom-half routine. */
  4723.      return;
  4724.  }
  4725. Only in linux.old/drivers/net: skeleton.c.ori
  4726. diff -u --new-file --recursive linux.old/drivers/net/slhc.c linux/drivers/net/slhc.c
  4727. --- linux.old/drivers/net/slhc.c    Fri May 20 18:45:13 1994
  4728. +++ linux/drivers/net/slhc.c    Fri May 20 18:51:08 1994
  4729. @@ -69,8 +69,6 @@
  4730.  #include <linux/mm.h>
  4731.  #include "slhc.h"
  4732.  
  4733. -#define DPRINT(x)
  4734. -
  4735.  int last_retran;
  4736.  
  4737.  static unsigned char *encode(unsigned char *cp, unsigned short n);
  4738. @@ -236,8 +234,6 @@
  4739.      /* Bail if this packet isn't TCP, or is an IP fragment */
  4740.      if(ip->protocol != IPPROTO_TCP || (ntohs(ip->frag_off) & 0x1fff) || 
  4741.                         (ip->frag_off & 32)){
  4742. -        DPRINT(("comp: noncomp 1 %d %d %d\n", ip->protocol, 
  4743. -              ntohs(ip->frag_off), ip->frag_off));
  4744.          /* Send as regular IP */
  4745.          if(ip->protocol != IPPROTO_TCP)
  4746.              comp->sls_o_nontcp++;
  4747. @@ -255,8 +251,6 @@
  4748.       */
  4749.      if(th->syn || th->fin || th->rst ||
  4750.          ! (th->ack)){
  4751. -        DPRINT(("comp: noncomp 2 %x %x %d %d %d %d\n", ip, th, 
  4752. -               th->syn, th->fin, th->rst, th->ack));
  4753.          /* TCP connection stuff; send as regular IP */
  4754.          comp->sls_o_tcp++;
  4755.          return isize;
  4756. @@ -300,7 +294,6 @@
  4757.       */
  4758.      comp->sls_o_misses++;
  4759.      comp->xmit_oldest = lcs->cs_this;
  4760. -    DPRINT(("comp: not found\n"));
  4761.      goto uncompressed;
  4762.  
  4763.  found:
  4764. @@ -341,7 +334,6 @@
  4765.       || th->doff != cs->cs_tcp.doff
  4766.       || (ip->ihl > 5 && memcmp(ip+1,cs->cs_ipopt,((ip->ihl)-5)*4) != 0)
  4767.       || (th->doff > 5 && memcmp(th+1,cs->cs_tcpopt,((th->doff)-5)*4 != 0))){
  4768. -        DPRINT(("comp: incompat\n"));
  4769.          goto uncompressed;
  4770.      }
  4771.      
  4772. @@ -360,7 +352,6 @@
  4773.           * implementation should never do this but RFC793
  4774.           * doesn't prohibit the change so we have to deal
  4775.           * with it. */
  4776. -        DPRINT(("comp: urg incompat\n"));
  4777.          goto uncompressed;
  4778.      }
  4779.      if((deltaS = ntohs(th->window) - ntohs(oth->window)) != 0){
  4780. @@ -391,7 +382,6 @@
  4781.          if(ip->tot_len != cs->cs_ip.tot_len && 
  4782.             ntohs(cs->cs_ip.tot_len) == hlen)
  4783.              break;
  4784. -        DPRINT(("comp: retrans\n"));
  4785.          goto uncompressed;
  4786.          break;
  4787.      case SPECIAL_I:
  4788. @@ -399,7 +389,6 @@
  4789.          /* actual changes match one of our special case encodings --
  4790.           * send packet uncompressed.
  4791.           */
  4792. -        DPRINT(("comp: special\n"));
  4793.          goto uncompressed;
  4794.      case NEW_S|NEW_A:
  4795.          if(deltaS == deltaA &&
  4796. @@ -450,7 +439,6 @@
  4797.      }
  4798.      cp = put16(cp,(short)deltaA);    /* Write TCP checksum */
  4799.  /* deltaS is now the size of the change section of the compressed header */
  4800. -    DPRINT(("comp: %x %x %x %d %d\n", icp, cp, new_seq, hlen, deltaS));
  4801.      memcpy(cp,new_seq,deltaS);    /* Write list of deltas */
  4802.      memcpy(cp+deltaS,icp+hlen,isize-hlen);
  4803.      comp->sls_o_compressed++;
  4804. @@ -493,7 +481,6 @@
  4805.      comp->sls_i_compressed++;
  4806.      if(isize < 3){
  4807.          comp->sls_i_error++;
  4808. -        DPRINT(("uncomp: runt\n"));
  4809.          return 0;
  4810.      }
  4811.      changes = *cp++;
  4812. @@ -513,7 +500,6 @@
  4813.           * explicit state index, we have to toss the packet. */
  4814.          if(comp->flags & SLF_TOSS){
  4815.              comp->sls_i_tossed++;
  4816. -            DPRINT(("uncomp: toss\n"));
  4817.              return 0;
  4818.          }
  4819.      }
  4820. @@ -522,7 +508,6 @@
  4821.      ip = &cs->cs_ip;
  4822.  
  4823.      if((x = pull16(&cp)) == -1) {    /* Read the TCP checksum */
  4824. -        DPRINT(("uncomp: bad tcp chk\n"));
  4825.          goto bad;
  4826.          }
  4827.      thp->check = htons(x);
  4828. @@ -555,7 +540,6 @@
  4829.          if(changes & NEW_U){
  4830.              thp->urg = 1;
  4831.              if((x = decode(&cp)) == -1) {
  4832. -                DPRINT(("uncomp: bad U\n"));
  4833.                  goto bad;
  4834.              }
  4835.              thp->urg_ptr = htons(x);
  4836. @@ -563,21 +547,18 @@
  4837.              thp->urg = 0;
  4838.          if(changes & NEW_W){
  4839.              if((x = decode(&cp)) == -1) {
  4840. -                DPRINT(("uncomp: bad W\n"));
  4841.                  goto bad;
  4842.              }    
  4843.              thp->window = htons( ntohs(thp->window) + x);
  4844.          }
  4845.          if(changes & NEW_A){
  4846.              if((x = decode(&cp)) == -1) {
  4847. -                DPRINT(("uncomp: bad A\n"));
  4848.                  goto bad;
  4849.              }
  4850.              thp->ack_seq = htonl( ntohl(thp->ack_seq) + x);
  4851.          }
  4852.          if(changes & NEW_S){
  4853.              if((x = decode(&cp)) == -1) {
  4854. -                DPRINT(("uncomp: bad S\n"));
  4855.                  goto bad;
  4856.              }
  4857.              thp->seq = htonl( ntohl(thp->seq) + x);
  4858. @@ -586,7 +567,6 @@
  4859.      }
  4860.      if(changes & NEW_I){
  4861.          if((x = decode(&cp)) == -1) {
  4862. -            DPRINT(("uncomp: bad I\n"));
  4863.              goto bad;
  4864.          }
  4865.          ip->id = htons (ntohs (ip->id) + x);
  4866. @@ -606,8 +586,6 @@
  4867.      ip->tot_len = htons(len);
  4868.      ip->check = 0;
  4869.  
  4870. -    DPRINT(("uncomp: %d %d %d %d\n", cp - icp, hdrlen, isize, len));
  4871. -
  4872.      memmove(icp + hdrlen, cp, len - hdrlen);
  4873.  
  4874.      cp = icp;
  4875. @@ -629,7 +607,6 @@
  4876.        cp += ((thp->doff) - 5) * 4;
  4877.      }
  4878.  
  4879. -if (inet_debug == DBG_SLIP) printk("\runcomp: change %x len %d\n", changes, len);
  4880.      return len;
  4881.  bad:
  4882.      comp->sls_i_error++;
  4883. Only in linux.old/drivers/net: slhc.c.orig
  4884. diff -u --new-file --recursive linux.old/drivers/net/slip.c linux/drivers/net/slip.c
  4885. --- linux.old/drivers/net/slip.c    Sat May 14 14:19:17 1994
  4886. +++ linux/drivers/net/slip.c    Fri May 20 18:51:09 1994
  4887. @@ -64,78 +64,13 @@
  4888.  #include "slhc.h"
  4889.  #endif
  4890.  
  4891. -#define    SLIP_VERSION    "0.7.5"
  4892. +#define    SLIP_VERSION    "0.7.5-NET3.014-NEWTTY"
  4893.  
  4894. -/* Define some IP layer stuff.  Not all systems have it. */
  4895. -#ifdef SL_DUMP
  4896. -#   define    IP_VERSION    4    /* version# of our IP software    */
  4897. -#   define    IPF_F_OFFSET    0x1fff    /* Offset field            */
  4898. -#   define    IPF_DF        0x4000    /* Don't fragment flag        */
  4899. -#   define    IPF_MF        0x2000    /* More Fragments flag        */
  4900. -#   define    IP_OF_COPIED    0x80    /* Copied-on-fragmentation flag    */
  4901. -#   define    IP_OF_CLASS    0x60    /* Option class            */
  4902. -#   define    IP_OF_NUMBER    0x1f    /* Option number        */
  4903. -#endif
  4904. -
  4905.  
  4906.  static struct slip    sl_ctrl[SL_NRUNIT];
  4907.  static struct tty_ldisc    sl_ldisc;
  4908.  static int        already = 0;
  4909.  
  4910. -/* Dump the contents of an IP datagram. */
  4911. -static void
  4912. -ip_dump(unsigned char *ptr, int len)
  4913. -{
  4914. -#ifdef SL_DUMP
  4915. -  struct iphdr *ip;
  4916. -  struct tcphdr *th;
  4917. -  int dlen, doff;
  4918. -
  4919. -  if (inet_debug != DBG_SLIP) return;
  4920. -
  4921. -  ip = (struct iphdr *) ptr;
  4922. -  th = (struct tcphdr *) (ptr + ip->ihl * 4);
  4923. -  printk("\r%s -> %s seq %lx ack %lx len %d\n",
  4924. -     in_ntoa(ip->saddr), in_ntoa(ip->daddr), 
  4925. -     ntohl(th->seq), ntohl(th->ack_seq), ntohs(ip->tot_len));
  4926. -  return;
  4927. -
  4928. -  printk("\r*****\n");
  4929. -  printk("%p %d\n", ptr, len);
  4930. -  ip = (struct iphdr *) ptr;
  4931. -  dlen = ntohs(ip->tot_len);
  4932. -  doff = ((ntohs(ip->frag_off) & IPF_F_OFFSET) << 3);
  4933. -
  4934. -
  4935. -  printk("SLIP: %s->", in_ntoa(ip->saddr));
  4936. -  printk("%s\n", in_ntoa(ip->daddr));
  4937. -  printk(" len %u ihl %u ver %u ttl %u prot %u",
  4938. -    dlen, ip->ihl, ip->version, ip->ttl, ip->protocol);
  4939. -
  4940. -  if (ip->tos != 0) printk(" tos %u", ip->tos);
  4941. -  if (doff != 0 || (ntohs(ip->frag_off) & IPF_MF))
  4942. -    printk(" id %u offs %u", ntohs(ip->id), doff);
  4943. -
  4944. -  if (ntohs(ip->frag_off) & IPF_DF) printk(" DF");
  4945. -  if (ntohs(ip->frag_off) & IPF_MF) printk(" MF");
  4946. -  printk("\n*****\n");
  4947. -#endif
  4948. -}
  4949. -
  4950. -#if 0
  4951. -void clh_dump(unsigned char *cp, int len)
  4952. -{
  4953. -  if (len > 60)
  4954. -    len = 60;
  4955. -  printk("%d:", len);
  4956. -  while (len > 0) {
  4957. -    printk(" %x", *cp++);
  4958. -    len--;
  4959. -  }
  4960. -  printk("\n\n");
  4961. -}
  4962. -#endif
  4963. -
  4964.  /* Initialize a SLIP control block for use. */
  4965.  static void
  4966.  sl_initialize(struct slip *sl, struct device *dev)
  4967. @@ -172,6 +107,8 @@
  4968.    dev->mem_end        = (unsigned long) NULL;
  4969.    dev->mem_start    = (unsigned long) NULL;
  4970.    dev->type        = ARPHRD_SLIP + sl->mode;
  4971. +  if(dev->type == 260)    /* KISS */
  4972. +      dev->type=ARPHRD_AX25;
  4973.  }
  4974.  
  4975.  /* Find a free SLIP channel, and link in this `tty' line. */
  4976. @@ -234,8 +171,6 @@
  4977.      if (l < (576 * 2))
  4978.        l = 576 * 2;
  4979.      
  4980. -    DPRINTF((DBG_SLIP,"SLIP: mtu changed!\n"));
  4981. -    
  4982.      tb= (unsigned char *) kmalloc(l + 4, GFP_ATOMIC);
  4983.      rb= (unsigned char *) kmalloc(l + 4, GFP_ATOMIC);
  4984.      cb= (unsigned char *) kmalloc(l + 4, GFP_ATOMIC);
  4985. @@ -400,13 +335,9 @@
  4986.      }
  4987.    }
  4988.  
  4989. -  DPRINTF((DBG_SLIP, "<< \"%s\" recv:\r\n", sl->dev->name));
  4990. -  ip_dump(sl->rbuff, sl->rcount);
  4991.  #endif
  4992.    /* Bump the datagram to the upper layers... */
  4993.    do {
  4994. -    DPRINTF((DBG_SLIP, "SLIP: packet is %d at 0x%X\n",
  4995. -                    sl->rcount, sl->rbuff));
  4996.      /* clh_dump(sl->rbuff, count); */
  4997.      done = dev_rint(sl->rbuff, count, 0, sl->dev);
  4998.      if (done == 0 || done == 1) break;
  4999. @@ -422,10 +353,6 @@
  5000.    unsigned char *p;
  5001.    int actual, count;
  5002.  
  5003. -  DPRINTF((DBG_SLIP, "SLIP: sl_encaps(0x%X, %d) called\n", icp, len));
  5004. -  DPRINTF((DBG_SLIP, ">> \"%s\" sent:\r\n", sl->dev->name));
  5005. -  
  5006. -  ip_dump(icp, len);
  5007.    
  5008.    if(sl->mtu != sl->dev->mtu)    /* Someone has been ifconfigging */
  5009.        sl_changedmtu(sl);
  5010. @@ -470,8 +397,6 @@
  5011.  
  5012.      /* First make sure we're connected. */
  5013.      if (!sl || sl->magic != SLIP_MAGIC) {
  5014. -        DPRINTF((DBG_SLIP, "SLIP write_wakeup: %s not connected !\n",
  5015. -             tty_name(tty)));
  5016.          return;
  5017.      }
  5018.  
  5019. @@ -526,8 +451,6 @@
  5020.    /* Find the correct SLIP channel to use. */
  5021.    sl = &sl_ctrl[dev->base_addr];
  5022.    tty = sl->tty;
  5023. -  DPRINTF((DBG_SLIP, "SLIP: sl_xmit(\"%s\") skb=0x%X busy=%d\n",
  5024. -                dev->name, skb, sl->sending));
  5025.  
  5026.    /*
  5027.     * If we are busy already- too bad.  We ought to be able
  5028. @@ -535,7 +458,6 @@
  5029.     * frame buffer.  Oh well...
  5030.     */
  5031.    if (sl->sending) {
  5032. -    DPRINTF((DBG_SLIP, "SLIP: sl_xmit: BUSY\r\n"));
  5033.      sl->sbusy++;
  5034.      return(1);
  5035.    }
  5036. @@ -559,7 +481,7 @@
  5037.      sl_lock(sl);
  5038.      
  5039.      size=skb->len;
  5040. -    
  5041. +#if 0    
  5042.      if(!(sl->mode&SL_MODE_AX25))
  5043.      {
  5044.          if(size<sizeof(struct iphdr))
  5045. @@ -573,6 +495,7 @@
  5046.          /*    sl_hex_dump(skb->data,skb->len);*/
  5047.          }
  5048.      }
  5049. +#endif    
  5050.      sl_encaps(sl, skb->data, size);
  5051.      if (skb->free) 
  5052.          kfree_skb(skb, FREE_WRITE);
  5053. @@ -600,10 +523,12 @@
  5054.        void *daddr, void *saddr, unsigned len, struct sk_buff *skb)
  5055.  {
  5056.  #ifdef CONFIG_AX25
  5057. +#ifdef CONFIG_INET
  5058.    struct slip *sl=&sl_ctrl[dev->base_addr];
  5059.    if((sl->mode&SL_MODE_AX25) && type!=htons(ETH_P_AX25))
  5060.        return ax25_encapsulate(buff,dev,type,daddr,saddr,len,skb);
  5061.  #endif  
  5062. +#endif
  5063.  
  5064.    return(0);
  5065.  }
  5066. @@ -615,10 +540,12 @@
  5067.          struct sk_buff *skb)
  5068.  {
  5069.  #ifdef CONFIG_AX25
  5070. +#ifdef CONFIG_INET
  5071.    struct slip *sl=&sl_ctrl[dev->base_addr];
  5072.    
  5073.    if(sl->mode&SL_MODE_AX25)
  5074.        return ax25_rebuild_header(buff,dev,raddr, skb);
  5075. +#endif      
  5076.  #endif  
  5077.    return(0);
  5078.  }
  5079. @@ -634,7 +561,6 @@
  5080.  
  5081.    sl = &sl_ctrl[dev->base_addr];
  5082.    if (sl->tty == NULL) {
  5083. -    DPRINTF((DBG_SLIP, "SLIP: channel %d not connected!\n", sl->line));
  5084.      return(-ENXIO);
  5085.    }
  5086.    sl->dev = dev;
  5087. @@ -658,7 +584,6 @@
  5088.  
  5089.    p = (unsigned char *) kmalloc(l + 4, GFP_KERNEL);
  5090.    if (p == NULL) {
  5091. -    DPRINTF((DBG_SLIP, "SLIP: no memory for SLIP XMIT buffer!\n"));
  5092.      return(-ENOMEM);
  5093.    }
  5094.    
  5095. @@ -668,7 +593,7 @@
  5096.  
  5097.    p = (unsigned char *) kmalloc(l + 4, GFP_KERNEL);
  5098.    if (p == NULL) {
  5099. -    DPRINTF((DBG_SLIP, "SLIP: no memory for SLIP RECV buffer!\n"));
  5100. +    kfree_s((void *)sl->dev->mem_start,l+4);
  5101.      return(-ENOMEM);
  5102.    }
  5103.    sl->dev->rmem_start    = (unsigned long) p;
  5104. @@ -686,25 +611,22 @@
  5105.    p = (unsigned char *) kmalloc(l + 4, GFP_KERNEL);
  5106.    if (p == NULL) {
  5107.        kfree((unsigned char *)sl->dev->mem_start);
  5108. -    DPRINTF((DBG_SLIP, "SLIP: no memory for SLIP COMPRESS buffer!\n"));
  5109.      return(-ENOMEM);
  5110.    }
  5111.    sl->cbuff        = p;
  5112. -
  5113. +#ifdef CONFIG_INET
  5114.    sl->slcomp = slhc_init(16, 16);
  5115.    if (sl->slcomp == NULL) {
  5116.        kfree((unsigned char *)sl->dev->mem_start);
  5117.        kfree((unsigned char *)sl->dev->rmem_start);
  5118.        kfree(sl->cbuff);
  5119. -    DPRINTF((DBG_SLIP, "SLIP: no memory for SLCOMP!\n"));
  5120.      return(-ENOMEM);
  5121.    }
  5122. -
  5123. +#endif
  5124.    dev->flags|=IFF_UP;
  5125.    /* Needed because address '0' is special */
  5126.    if(dev->pa_addr==0)
  5127.        dev->pa_addr=ntohl(0xC0000001);
  5128. -  DPRINTF((DBG_SLIP, "SLIP: channel %d opened.\n", sl->line));
  5129.    return(0);
  5130.  }
  5131.  
  5132. @@ -717,7 +639,6 @@
  5133.  
  5134.    sl = &sl_ctrl[dev->base_addr];
  5135.    if (sl->tty == NULL) {
  5136. -    DPRINTF((DBG_SLIP, "SLIP: channel %d not connected!\n", sl->line));
  5137.      return(-EBUSY);
  5138.    }
  5139.    sl->tty->disc_data = 0;
  5140. @@ -727,11 +648,11 @@
  5141.    kfree(sl->rbuff);
  5142.    kfree(sl->xbuff);
  5143.    kfree(sl->cbuff);
  5144. +#ifdef CONFIG_INET  
  5145.    slhc_free(sl->slcomp);
  5146. -
  5147. +#endif
  5148.    sl_initialize(sl, dev);
  5149.  
  5150. -  DPRINTF((DBG_SLIP, "SLIP: channel %d closed.\n", sl->line));
  5151.    return(0);
  5152.  }
  5153.  
  5154. @@ -747,9 +668,6 @@
  5155.  {
  5156.      struct slip *sl = (struct slip *) tty->disc_data;
  5157.    
  5158. -    DPRINTF((DBG_SLIP, "SLIP: slip_receive_buf(%s) called\n",
  5159. -         _tty_name(tty, buff)));
  5160. -    
  5161.      if (!sl || sl->magic != SLIP_MAGIC)
  5162.          return;
  5163.    
  5164. @@ -788,15 +706,11 @@
  5165.  
  5166.    /* First make sure we're not already connected. */
  5167.    if (sl && sl->magic == SLIP_MAGIC) {
  5168. -    DPRINTF((DBG_SLIP, "SLIP: %s already connected to %s !\n",
  5169. -                    tty_name(tty), sl->dev->name));
  5170.      return(-EEXIST);
  5171.    }
  5172.  
  5173.    /* OK.  Find a free SLIP channel to use. */
  5174.    if ((sl = sl_alloc()) == NULL) {
  5175. -    DPRINTF((DBG_SLIP, "SLIP: %s not connected: all channels in use!\n",
  5176. -                    tty_name(tty)));
  5177.      return(-ENFILE);
  5178.    }
  5179.    sl->tty = tty;
  5180. @@ -808,8 +722,6 @@
  5181.  
  5182.    /* Perform the low-level SLIP initialization. */
  5183.    (void) sl_open(sl->dev);
  5184. -  DPRINTF((DBG_SLIP, "SLIP: %s connected to %s.\n",
  5185. -                tty_name(tty), sl->dev->name));
  5186.  
  5187.    /* Done.  We have linked the TTY line to a channel. */
  5188.    return(sl->line);
  5189. @@ -835,7 +747,7 @@
  5190.      stats.tx_packets = sl->spacket;
  5191.      stats.tx_dropped = sl->sbusy;
  5192.      stats.rx_errors = sl->errors;
  5193. -
  5194. +#ifdef CONFIG_INET
  5195.      comp = sl->slcomp;
  5196.      if (comp) {
  5197.        stats.rx_fifo_errors = comp->sls_i_compressed;
  5198. @@ -843,7 +755,7 @@
  5199.        stats.tx_fifo_errors = comp->sls_o_compressed;
  5200.        stats.collisions = comp->sls_o_misses;
  5201.      }
  5202. -
  5203. +#endif
  5204.      return (&stats);
  5205.  }
  5206.  
  5207. @@ -860,16 +772,13 @@
  5208.  
  5209.    /* First make sure we're connected. */
  5210.    if (!sl || sl->magic != SLIP_MAGIC) {
  5211. -    DPRINTF((DBG_SLIP, "SLIP: %s not connected !\n", tty_name(tty)));
  5212. -    return;
  5213. +      return;
  5214.    }
  5215.  
  5216.    (void) dev_close(sl->dev);
  5217. -  DPRINTF((DBG_SLIP, "SLIP: %s disconnected from %s.\n",
  5218. -                    tty_name(tty), sl->dev->name));
  5219.  }
  5220.  
  5221. +
  5222.   /************************************************************************
  5223.    *            STANDARD SLIP ENCAPSULATION            *
  5224.    ************************************************************************
  5225. @@ -1057,13 +966,9 @@
  5226.  
  5227.    /* First make sure we're connected. */
  5228.    if (!sl || sl->magic != SLIP_MAGIC) {
  5229. -    DPRINTF((DBG_SLIP, "SLIP: ioctl: %s not connected !\n",
  5230. -         tty_name(tty)));
  5231.      return(-EINVAL);
  5232.    }
  5233.  
  5234. -  DPRINTF((DBG_SLIP, "SLIP: ioctl(%s, 0x%X, 0x%X)\n", tty_name(tty),
  5235. -       cmd, arg));
  5236.    switch(cmd) {
  5237.      case SIOCGIFNAME:
  5238.          err=verify_area(VERIFY_WRITE, arg, 16);
  5239. @@ -1091,6 +996,8 @@
  5240.          }
  5241.  #endif        
  5242.          sl->dev->type=ARPHRD_SLIP+sl->mode;
  5243. +        if(sl->dev->type==260)
  5244. +            sl->dev->type=ARPHRD_AX25;
  5245.          return(0);
  5246.      case SIOCSIFHWADDR:
  5247.  #ifdef CONFIG_AX25    
  5248. Only in linux.old/drivers/net: slip.c.orig
  5249. Only in linux.old/drivers/net: smc-ultra.c.or
  5250. Only in linux.old/drivers/net: wd.c.orig
  5251. Only in linux.old/drivers/scsi: README.st.orig
  5252. Only in linux.old/drivers/scsi: aha1542.c.orig
  5253. Only in linux.old/drivers/scsi: fdomain.c.orig
  5254. Only in linux.old/drivers/scsi: fdomain.h.orig
  5255. Only in linux.old/drivers/scsi: scsi.c.orig
  5256. Only in linux.old/drivers/scsi: scsi.h.orig
  5257. Only in linux.old/drivers/scsi: scsi_debug.c.o
  5258. Only in linux.old/drivers/scsi: scsi_debug.h.o
  5259. Only in linux.old/drivers/scsi: scsi_ioctl.c.o
  5260. Only in linux.old/drivers/scsi: scsi_ioctl.h.o
  5261. Only in linux.old/drivers/scsi: sd.c.orig
  5262. Only in linux.old/drivers/scsi: sd_ioctl.c.ori
  5263. Only in linux.old/drivers/scsi: sr.c.orig
  5264. Only in linux.old/drivers/scsi: sr_ioctl.c.ori
  5265. Only in linux.old/drivers/scsi: st.c.orig
  5266. Only in linux.old/drivers/scsi: st.h.orig
  5267. Only in linux.old/drivers/scsi: wd7000.c.orig
  5268. Only in linux.old/drivers/scsi: wd7000.h.orig
  5269. Only in linux.old/drivers/sound: CHANGELOG.orig
  5270. Only in linux.old/drivers/sound: Gus_linearvol.
  5271. Only in linux.old/drivers/sound: Makefile.orig
  5272. Only in linux.old/drivers/sound: Readme.linux.o
  5273. Only in linux.old/drivers/sound: Readme.orig
  5274. Only in linux.old/drivers/sound: Sound_switch.c
  5275. Only in linux.old/drivers/sound: adlib_card.c.o
  5276. Only in linux.old/drivers/sound: audio.c.orig
  5277. Only in linux.old/drivers/sound: configure.c.or
  5278. Only in linux.old/drivers/sound: dev_table.c.or
  5279. Only in linux.old/drivers/sound: dev_table.h.or
  5280. Only in linux.old/drivers/sound: dmabuf.c.orig
  5281. Only in linux.old/drivers/sound: gus_card.c.ori
  5282. Only in linux.old/drivers/sound: gus_hw.h.orig
  5283. diff -u --new-file --recursive linux.old/drivers/sound/gus_linearvol. linux/drivers/sound/gus_linearvol.
  5284. --- linux.old/drivers/sound/gus_linearvol.    Fri May 20 18:46:18 1994
  5285. +++ linux/drivers/sound/gus_linearvol.    Fri May 20 18:51:46 1994
  5286. @@ -1,18 +0,0 @@
  5287. -static unsigned short gus_linearvol[128] = {
  5288. - 0x0000, 0x08ff, 0x09ff, 0x0a80, 0x0aff, 0x0b40, 0x0b80, 0x0bc0,
  5289. - 0x0bff, 0x0c20, 0x0c40, 0x0c60, 0x0c80, 0x0ca0, 0x0cc0, 0x0ce0,
  5290. - 0x0cff, 0x0d10, 0x0d20, 0x0d30, 0x0d40, 0x0d50, 0x0d60, 0x0d70,
  5291. - 0x0d80, 0x0d90, 0x0da0, 0x0db0, 0x0dc0, 0x0dd0, 0x0de0, 0x0df0,
  5292. - 0x0dff, 0x0e08, 0x0e10, 0x0e18, 0x0e20, 0x0e28, 0x0e30, 0x0e38,
  5293. - 0x0e40, 0x0e48, 0x0e50, 0x0e58, 0x0e60, 0x0e68, 0x0e70, 0x0e78,
  5294. - 0x0e80, 0x0e88, 0x0e90, 0x0e98, 0x0ea0, 0x0ea8, 0x0eb0, 0x0eb8,
  5295. - 0x0ec0, 0x0ec8, 0x0ed0, 0x0ed8, 0x0ee0, 0x0ee8, 0x0ef0, 0x0ef8,
  5296. - 0x0eff, 0x0f04, 0x0f08, 0x0f0c, 0x0f10, 0x0f14, 0x0f18, 0x0f1c,
  5297. - 0x0f20, 0x0f24, 0x0f28, 0x0f2c, 0x0f30, 0x0f34, 0x0f38, 0x0f3c,
  5298. - 0x0f40, 0x0f44, 0x0f48, 0x0f4c, 0x0f50, 0x0f54, 0x0f58, 0x0f5c,
  5299. - 0x0f60, 0x0f64, 0x0f68, 0x0f6c, 0x0f70, 0x0f74, 0x0f78, 0x0f7c,
  5300. - 0x0f80, 0x0f84, 0x0f88, 0x0f8c, 0x0f90, 0x0f94, 0x0f98, 0x0f9c,
  5301. - 0x0fa0, 0x0fa4, 0x0fa8, 0x0fac, 0x0fb0, 0x0fb4, 0x0fb8, 0x0fbc,
  5302. - 0x0fc0, 0x0fc4, 0x0fc8, 0x0fcc, 0x0fd0, 0x0fd4, 0x0fd8, 0x0fdc,
  5303. - 0x0fe0, 0x0fe4, 0x0fe8, 0x0fec, 0x0ff0, 0x0ff4, 0x0ff8, 0x0ffc
  5304. -};
  5305. Only in linux.old/drivers/sound: gus_midi.c.ori
  5306. Only in linux.old/drivers/sound: gus_vol.c.orig
  5307. Only in linux.old/drivers/sound: gus_wave.c.ori
  5308. Only in linux.old/drivers/sound: ics2101.c.orig
  5309. Only in linux.old/drivers/sound: midibuf.c.orig
  5310. Only in linux.old/drivers/sound: mpu401.c.orig
  5311. Only in linux.old/drivers/sound: opl3.c.orig
  5312. Only in linux.old/drivers/sound: os.h.orig
  5313. Only in linux.old/drivers/sound: pas.h.orig
  5314. Only in linux.old/drivers/sound: pas2_card.c.or
  5315. Only in linux.old/drivers/sound: pas2_midi.c.or
  5316. Only in linux.old/drivers/sound: pas2_mixer.c.o
  5317. Only in linux.old/drivers/sound: pas2_pcm.c.ori
  5318. Only in linux.old/drivers/sound: patmgr.c.orig
  5319. Only in linux.old/drivers/sound: sb16_dsp.c.ori
  5320. Only in linux.old/drivers/sound: sb16_midi.c.or
  5321. Only in linux.old/drivers/sound: sb_card.c.orig
  5322. Only in linux.old/drivers/sound: sb_dsp.c.orig
  5323. Only in linux.old/drivers/sound: sb_midi.c.orig
  5324. Only in linux.old/drivers/sound: sb_mixer.c.ori
  5325. Only in linux.old/drivers/sound: sb_mixer.h.ori
  5326. Only in linux.old/drivers/sound: sequencer.c.or
  5327. diff -u --new-file --recursive linux.old/drivers/sound/sound_switch.c linux/drivers/sound/sound_switch.c
  5328. --- linux.old/drivers/sound/sound_switch.c    Fri May 20 18:46:29 1994
  5329. +++ linux/drivers/sound/sound_switch.c    Fri May 20 18:51:48 1994
  5330. @@ -1,10 +1,10 @@
  5331.  /*
  5332.   * sound/sound_switch.c
  5333. - *
  5334. + * 
  5335.   * The system call switch
  5336. - *
  5337. + * 
  5338.   * Copyright by Hannu Savolainen 1993
  5339. - *
  5340. + * 
  5341.   * Redistribution and use in source and binary forms, with or without
  5342.   * modification, are permitted provided that the following conditions are
  5343.   * met: 1. Redistributions of source code must retain the above copyright
  5344. @@ -12,7 +12,7 @@
  5345.   * Redistributions in binary form must reproduce the above copyright notice,
  5346.   * this list of conditions and the following disclaimer in the documentation
  5347.   * and/or other materials provided with the distribution.
  5348. - *
  5349. + * 
  5350.   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
  5351.   * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  5352.   * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  5353. @@ -24,7 +24,7 @@
  5354.   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  5355.   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  5356.   * SUCH DAMAGE.
  5357. - *
  5358. + * 
  5359.   */
  5360.  
  5361.  #include "sound_config.h"
  5362. @@ -32,16 +32,13 @@
  5363.  #ifdef CONFIGURE_SOUNDCARD
  5364.  
  5365.  struct sbc_device
  5366. -  {
  5367. -    int             usecount;
  5368. -  };
  5369. -
  5370. -static struct sbc_device sbc_devices[SND_NDEVS] =
  5371.  {
  5372. -  {0}};
  5373. +  int             usecount;
  5374. +};
  5375.  
  5376. -static int      in_use = 0;    /* Total # of open device files (excluding
  5377. +static struct sbc_device sbc_devices[SND_NDEVS] = {{0}};
  5378.  
  5379. +static int      in_use = 0;    /* Total # of open device files (excluding
  5380.                   * minor 0) */
  5381.  
  5382.  /*
  5383. @@ -56,7 +53,7 @@
  5384.  {
  5385.    int             l;
  5386.  
  5387. -  for (l = 0; l < 256, s[l]; l++);    /* l=strlen(s); */
  5388. +  for (l=0;l<256,s[l];l++);    /* l=strlen(s); */
  5389.  
  5390.    if (status_len + l >= 4000)
  5391.      return 0;
  5392. @@ -72,28 +69,27 @@
  5393.  {
  5394.    int             l, v;
  5395.  
  5396. -  static char     hx[] = "0123456789abcdef";
  5397. -  char            buf[11];
  5398. +  static char hx[] = "0123456789abcdef";
  5399. +  char buf[11];
  5400.  
  5401. -  if (!val)
  5402. -    return put_status ("0");
  5403. +  if (!val) return put_status("0");
  5404.  
  5405.    l = 0;
  5406. -  buf[10] = 0;
  5407. +  buf[10]=0;
  5408.  
  5409.    while (val)
  5410. -    {
  5411. -      v = val % radix;
  5412. -      val = val / radix;
  5413. +  {
  5414. +      v = val % radix;
  5415. +      val = val / radix;
  5416.  
  5417. -      buf[9 - l] = hx[v];
  5418. -      l++;
  5419. -    }
  5420. +      buf[9-l] = hx[v];
  5421. +      l++;
  5422. +  }
  5423.  
  5424.    if (status_len + l >= 4000)
  5425.      return 0;
  5426.  
  5427. -  memcpy (&status_buf[status_len], &buf[10 - l], l);
  5428. +  memcpy (&status_buf[status_len], &buf[10-l], l);
  5429.    status_len += l;
  5430.  
  5431.    return 1;
  5432. @@ -118,42 +114,32 @@
  5433.  
  5434.    if (!put_status ("Config options: "))
  5435.      return;
  5436. -  if (!put_status_int (SELECTED_SOUND_OPTIONS, 16))
  5437. -    return;
  5438. +  if (!put_status_int(SELECTED_SOUND_OPTIONS, 16))
  5439. +     return;
  5440.  
  5441.    if (!put_status ("\n\nHW config: \n"))
  5442.      return;
  5443.  
  5444.    for (i = 0; i < (num_sound_drivers - 1); i++)
  5445.      {
  5446. -      if (!supported_drivers[i].enabled)
  5447. -    if (!put_status ("("))
  5448. -      return;
  5449. -
  5450. -      if (!put_status ("Type "))
  5451. -    return;
  5452. -      if (!put_status_int (supported_drivers[i].card_type, 10))
  5453. +      if (!supported_drivers[i].enabled) 
  5454. +      if (!put_status ("("))
  5455.      return;
  5456. -      if (!put_status (": "))
  5457. -    return;
  5458. -      if (!put_status (supported_drivers[i].name))
  5459. -    return;
  5460. -      if (!put_status (" at 0x"))
  5461. -    return;
  5462. -      if (!put_status_int (supported_drivers[i].config.io_base, 16))
  5463. -    return;
  5464. -      if (!put_status (" irq "))
  5465. -    return;
  5466. -      if (!put_status_int (supported_drivers[i].config.irq, 10))
  5467. -    return;
  5468. -      if (!put_status (" drq "))
  5469. -    return;
  5470. -      if (!put_status_int (supported_drivers[i].config.dma, 10))
  5471. -    return;
  5472. +
  5473. +      if (!put_status ("Type ")) return;
  5474. +      if (!put_status_int(supported_drivers[i].card_type, 10)) return;
  5475. +      if (!put_status (": ")) return;
  5476. +      if (!put_status (supported_drivers[i].name)) return;
  5477. +      if (!put_status (" at 0x")) return;
  5478. +      if (!put_status_int(supported_drivers[i].config.io_base, 16)) return;
  5479. +      if (!put_status (" irq ")) return;
  5480. +      if (!put_status_int(supported_drivers[i].config.irq, 10)) return;
  5481. +      if (!put_status (" drq ")) return;
  5482. +      if (!put_status_int(supported_drivers[i].config.dma, 10)) return;
  5483.  
  5484. -      if (!supported_drivers[i].enabled)
  5485. -    if (!put_status (")"))
  5486. -      return;
  5487. +      if (!supported_drivers[i].enabled) 
  5488. +      if (!put_status (")"))
  5489. +    return;
  5490.  
  5491.        if (!put_status ("\n"))
  5492.      return;
  5493. @@ -164,14 +150,10 @@
  5494.  
  5495.    for (i = 0; i < num_dspdevs; i++)
  5496.      {
  5497. -      if (!put_status_int (i, 10))
  5498. -    return;
  5499. -      if (!put_status (": "))
  5500. -    return;
  5501. -      if (!put_status (dsp_devs[i]->name))
  5502. -    return;
  5503. -      if (!put_status ("\n"))
  5504. -    return;
  5505. +      if (!put_status_int(i, 10)) return;
  5506. +      if (!put_status(": "))return;
  5507. +      if (!put_status(dsp_devs[i]->name))return;
  5508. +      if (!put_status("\n"))return;
  5509.      }
  5510.  
  5511.    if (!put_status ("\nSynth devices:\n"))
  5512. @@ -179,14 +161,10 @@
  5513.  
  5514.    for (i = 0; i < num_synths; i++)
  5515.      {
  5516. -      if (!put_status_int (i, 10))
  5517. -    return;
  5518. -      if (!put_status (": "))
  5519. -    return;
  5520. -      if (!put_status (synth_devs[i]->info->name))
  5521. -    return;
  5522. -      if (!put_status ("\n"))
  5523. -    return;
  5524. +      if (!put_status_int(i, 10)) return;
  5525. +      if (!put_status(": "))return;
  5526. +      if (!put_status(synth_devs[i]->info->name))return;
  5527. +      if (!put_status("\n"))return;
  5528.      }
  5529.  
  5530.    if (!put_status ("\nMidi devices:\n"))
  5531. @@ -194,14 +172,10 @@
  5532.  
  5533.    for (i = 0; i < num_midis; i++)
  5534.      {
  5535. -      if (!put_status_int (i, 10))
  5536. -    return;
  5537. -      if (!put_status (": "))
  5538. -    return;
  5539. -      if (!put_status (midi_devs[i]->info.name))
  5540. -    return;
  5541. -      if (!put_status ("\n"))
  5542. -    return;
  5543. +      if (!put_status_int(i, 10)) return;
  5544. +      if (!put_status(": "))return;
  5545. +      if (!put_status(midi_devs[i]->info.name))return;
  5546. +      if (!put_status("\n"))return;
  5547.      }
  5548.  
  5549.    if (num_mixers)
  5550. @@ -217,7 +191,7 @@
  5551.  }
  5552.  
  5553.  static int
  5554. -read_status (snd_rw_buf * buf, int count)
  5555. +read_status (snd_rw_buf *buf, int count)
  5556.  {
  5557.    /*
  5558.     * Return at most 'count' bytes from the status_buf.
  5559. @@ -232,14 +206,14 @@
  5560.    if (l <= 0)
  5561.      return 0;
  5562.  
  5563. -  COPY_TO_USER (buf, 0, &status_buf[status_ptr], l);
  5564. +  COPY_TO_USER(buf, 0, &status_buf[status_ptr], l);
  5565.    status_ptr += l;
  5566.  
  5567.    return l;
  5568.  }
  5569.  
  5570.  int
  5571. -sound_read_sw (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
  5572. +sound_read_sw (int dev, struct fileinfo *file, snd_rw_buf *buf, int count)
  5573.  {
  5574.    DEB (printk ("sound_read_sw(dev=%d, count=%d)\n", dev, count));
  5575.  
  5576. @@ -272,7 +246,7 @@
  5577.  }
  5578.  
  5579.  int
  5580. -sound_write_sw (int dev, struct fileinfo *file, snd_rw_buf * buf, int count)
  5581. +sound_write_sw (int dev, struct fileinfo *file, snd_rw_buf *buf, int count)
  5582.  {
  5583.  
  5584.    DEB (printk ("sound_write_sw(dev=%d, count=%d)\n", dev, count));
  5585. @@ -301,7 +275,6 @@
  5586.  sound_open_sw (int dev, struct fileinfo *file)
  5587.  {
  5588.    int             retval;
  5589. -
  5590.    DEB (printk ("sound_open_sw(dev=%d) : usecount=%d\n", dev, sbc_devices[dev].usecount));
  5591.  
  5592.    if ((dev >= SND_NDEVS) || (dev < 0))
  5593. @@ -400,7 +373,7 @@
  5594.  
  5595.  int
  5596.  sound_ioctl_sw (int dev, struct fileinfo *file,
  5597. -        unsigned int cmd, unsigned long arg)
  5598. +         unsigned int cmd, unsigned long arg)
  5599.  {
  5600.    DEB (printk ("sound_ioctl_sw(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg));
  5601.  
  5602. @@ -441,5 +414,4 @@
  5603.  
  5604.    return RET_ERROR (EPERM);
  5605.  }
  5606. -
  5607.  #endif
  5608. Only in linux.old/drivers/sound: soundcard.c.or
  5609. Only in linux.old/fs: binfmt_elf.c.o
  5610. Only in linux.old/fs: buffer.c.orig
  5611. Only in linux.old/fs: devices.c.orig
  5612. Only in linux.old/fs: exec.c.orig
  5613. Only in linux.old/fs/ext: file.c.orig
  5614. Only in linux.old/fs/ext: freelists.c.or
  5615. Only in linux.old/fs/ext: inode.c.orig
  5616. Only in linux.old/fs/ext: namei.c.orig
  5617. Only in linux.old/fs/ext: symlink.c.orig
  5618. Only in linux.old/fs/ext: truncate.c.ori
  5619. Only in linux.old/fs/ext2: balloc.c.orig
  5620. Only in linux.old/fs/ext2: file.c.orig
  5621. Only in linux.old/fs/ext2: ialloc.c.orig
  5622. Only in linux.old/fs/ext2: inode.c.orig
  5623. Only in linux.old/fs/ext2: namei.c.orig
  5624. Only in linux.old/fs/ext2: super.c.orig
  5625. Only in linux.old/fs/ext2: symlink.c.orig
  5626. Only in linux.old/fs/ext2: truncate.c.ori
  5627. Only in linux.old/fs: fcntl.c.orig
  5628. Only in linux.old/fs/hpfs: hpfs_fs.c.orig
  5629. Only in linux.old/fs: inode.c.orig
  5630. Only in linux.old/fs: ioctl.c.orig
  5631. Only in linux.old/fs/isofs: dir.c.orig
  5632. Only in linux.old/fs/isofs: file.c.orig
  5633. Only in linux.old/fs/isofs: inode.c.orig
  5634. Only in linux.old/fs/isofs: rock.c.orig
  5635. Only in linux.old/fs/isofs: symlink.c.orig
  5636. Only in linux.old/fs: locks.c.orig
  5637. Only in linux.old/fs/minix: bitmap.c.orig
  5638. Only in linux.old/fs/minix: file.c.orig
  5639. Only in linux.old/fs/minix: inode.c.orig
  5640. Only in linux.old/fs/minix: namei.c.orig
  5641. Only in linux.old/fs/minix: symlink.c.orig
  5642. Only in linux.old/fs/minix: truncate.c.ori
  5643. Only in linux.old/fs/msdos: fat.c.orig
  5644. Only in linux.old/fs/msdos: file.c.orig
  5645. Only in linux.old/fs/msdos: inode.c.orig
  5646. Only in linux.old/fs/msdos: misc.c.orig
  5647. Only in linux.old/fs/msdos: namei.c.orig
  5648. Only in linux.old/fs: namei.c.orig
  5649. Only in linux.old/fs/nfs: inode.c.orig
  5650. Only in linux.old/fs/nfs: mmap.c.orig
  5651. diff -u --new-file --recursive linux.old/fs/nfs/proc.c linux/fs/nfs/proc.c
  5652. --- linux.old/fs/nfs/proc.c    Mon Feb 14 10:48:36 1994
  5653. +++ linux/fs/nfs/proc.c    Fri May 20 18:49:43 1994
  5654. @@ -4,6 +4,16 @@
  5655.   *  Copyright (C) 1992, 1993, 1994  Rick Sladkey
  5656.   *
  5657.   *  OS-independent nfs remote procedure call functions
  5658. + *
  5659. + *  Tuned by Alan Cox <A.Cox@swansea.ac.uk> for >3K buffers
  5660. + *  so at last we can have decent(ish) throughput off a 
  5661. + *  Sun server.
  5662. + *
  5663. + *  FixMe: We ought to define a sensible small max size for
  5664. + *  things like getattr that are tiny packets and use the
  5665. + *  old get_free_page stuff with it.
  5666. + *
  5667. + *  Feel free to fix it and mail me the diffs if it worries you.
  5668.   */
  5669.  
  5670.  /*
  5671. @@ -20,6 +30,7 @@
  5672.  #include <linux/param.h>
  5673.  #include <linux/sched.h>
  5674.  #include <linux/mm.h>
  5675. +#include <linux/malloc.h>
  5676.  #include <linux/nfs_fs.h>
  5677.  #include <linux/utsname.h>
  5678.  #include <linux/errno.h>
  5679. @@ -48,15 +59,18 @@
  5680.  /*
  5681.   * Our memory allocation and release functions.
  5682.   */
  5683. +#define NFS_SLACK_SPACE        1024    /* Total overkill */ 
  5684.  
  5685. -static inline int *nfs_rpc_alloc(void)
  5686. +static inline int *nfs_rpc_alloc(int size)
  5687.  {
  5688. -    return (int *) __get_free_page(GFP_KERNEL);
  5689. +    size+=NFS_SLACK_SPACE;        /* Allow for the NFS crap as well as buffer */
  5690. +    return (int *)kmalloc(size,GFP_KERNEL);
  5691.  }
  5692.  
  5693.  static inline void nfs_rpc_free(int *p)
  5694.  {
  5695. -    free_page((long) p);
  5696. +    kfree((void *)p);
  5697.  }
  5698.  
  5699.  /*
  5700. @@ -195,7 +209,7 @@
  5701.      int ruid = 0;
  5702.  
  5703.      PRINTK("NFS call  getattr\n");
  5704. -    if (!(p0 = nfs_rpc_alloc()))
  5705. +    if (!(p0 = nfs_rpc_alloc(server->rsize)))
  5706.          return -EIO;
  5707.  retry:
  5708.      p = nfs_rpc_header(p0, NFSPROC_GETATTR, ruid);
  5709. @@ -229,7 +243,7 @@
  5710.      int ruid = 0;
  5711.  
  5712.      PRINTK("NFS call  setattr\n");
  5713. -    if (!(p0 = nfs_rpc_alloc()))
  5714. +    if (!(p0 = nfs_rpc_alloc(server->wsize)))
  5715.          return -EIO;
  5716.  retry:
  5717.      p = nfs_rpc_header(p0, NFSPROC_SETATTR, ruid);
  5718. @@ -268,7 +282,7 @@
  5719.      if (!strcmp(name, "xyzzy"))
  5720.          proc_debug = 1 - proc_debug;
  5721.  #endif
  5722. -    if (!(p0 = nfs_rpc_alloc()))
  5723. +    if (!(p0 = nfs_rpc_alloc(server->rsize)))
  5724.          return -EIO;
  5725.  retry:
  5726.      p = nfs_rpc_header(p0, NFSPROC_LOOKUP, ruid);
  5727. @@ -304,7 +318,7 @@
  5728.      int ruid = 0;
  5729.  
  5730.      PRINTK("NFS call  readlink\n");
  5731. -    if (!(p0 = nfs_rpc_alloc()))
  5732. +    if (!(p0 = nfs_rpc_alloc(server->rsize)))
  5733.          return -EIO;
  5734.  retry:
  5735.      p = nfs_rpc_header(p0, NFSPROC_READLINK, ruid);
  5736. @@ -343,7 +357,7 @@
  5737.      int len = 0; /* = 0 is for gcc */
  5738.  
  5739.      PRINTK("NFS call  read %d @ %d\n", count, offset);
  5740. -    if (!(p0 = nfs_rpc_alloc()))
  5741. +    if (!(p0 = nfs_rpc_alloc(server->rsize)))
  5742.          return -EIO;
  5743.  retry:
  5744.      p = nfs_rpc_header(p0, NFSPROC_READ, ruid);
  5745. @@ -385,7 +399,7 @@
  5746.      int ruid = 0;
  5747.  
  5748.      PRINTK("NFS call  write %d @ %d\n", count, offset);
  5749. -    if (!(p0 = nfs_rpc_alloc()))
  5750. +    if (!(p0 = nfs_rpc_alloc(server->wsize)))
  5751.          return -EIO;
  5752.  retry:
  5753.      p = nfs_rpc_header(p0, NFSPROC_WRITE, ruid);
  5754. @@ -424,7 +438,7 @@
  5755.      int ruid = 0;
  5756.  
  5757.      PRINTK("NFS call  create %s\n", name);
  5758. -    if (!(p0 = nfs_rpc_alloc()))
  5759. +    if (!(p0 = nfs_rpc_alloc(server->wsize)))
  5760.          return -EIO;
  5761.  retry:
  5762.      p = nfs_rpc_header(p0, NFSPROC_CREATE, ruid);
  5763. @@ -460,7 +474,7 @@
  5764.      int ruid = 0;
  5765.  
  5766.      PRINTK("NFS call  remove %s\n", name);
  5767. -    if (!(p0 = nfs_rpc_alloc()))
  5768. +    if (!(p0 = nfs_rpc_alloc(server->wsize)))
  5769.          return -EIO;
  5770.  retry:
  5771.      p = nfs_rpc_header(p0, NFSPROC_REMOVE, ruid);
  5772. @@ -495,7 +509,7 @@
  5773.      int ruid = 0;
  5774.  
  5775.      PRINTK("NFS call  rename %s -> %s\n", old_name, new_name);
  5776. -    if (!(p0 = nfs_rpc_alloc()))
  5777. +    if (!(p0 = nfs_rpc_alloc(server->wsize)))
  5778.          return -EIO;
  5779.  retry:
  5780.      p = nfs_rpc_header(p0, NFSPROC_RENAME, ruid);
  5781. @@ -531,7 +545,7 @@
  5782.      int ruid = 0;
  5783.  
  5784.      PRINTK("NFS call  link %s\n", name);
  5785. -    if (!(p0 = nfs_rpc_alloc()))
  5786. +    if (!(p0 = nfs_rpc_alloc(server->wsize)))
  5787.          return -EIO;
  5788.  retry:
  5789.      p = nfs_rpc_header(p0, NFSPROC_LINK, ruid);
  5790. @@ -566,7 +580,7 @@
  5791.      int ruid = 0;
  5792.  
  5793.      PRINTK("NFS call  symlink %s -> %s\n", name, path);
  5794. -    if (!(p0 = nfs_rpc_alloc()))
  5795. +    if (!(p0 = nfs_rpc_alloc(server->wsize)))
  5796.          return -EIO;
  5797.  retry:
  5798.      p = nfs_rpc_header(p0, NFSPROC_SYMLINK, ruid);
  5799. @@ -603,7 +617,7 @@
  5800.      int ruid = 0;
  5801.  
  5802.      PRINTK("NFS call  mkdir %s\n", name);
  5803. -    if (!(p0 = nfs_rpc_alloc()))
  5804. +    if (!(p0 = nfs_rpc_alloc(server->wsize)))
  5805.          return -EIO;
  5806.  retry:
  5807.      p = nfs_rpc_header(p0, NFSPROC_MKDIR, ruid);
  5808. @@ -639,7 +653,7 @@
  5809.      int ruid = 0;
  5810.  
  5811.      PRINTK("NFS call  rmdir %s\n", name);
  5812. -    if (!(p0 = nfs_rpc_alloc()))
  5813. +    if (!(p0 = nfs_rpc_alloc(server->wsize)))
  5814.          return -EIO;
  5815.  retry:
  5816.      p = nfs_rpc_header(p0, NFSPROC_RMDIR, ruid);
  5817. @@ -677,7 +691,7 @@
  5818.  
  5819.      PRINTK("NFS call  readdir %d @ %d\n", count, cookie);
  5820.      size = server->rsize;
  5821. -    if (!(p0 = nfs_rpc_alloc()))
  5822. +    if (!(p0 = nfs_rpc_alloc(server->rsize)))
  5823.          return -EIO;
  5824.  retry:
  5825.      p = nfs_rpc_header(p0, NFSPROC_READDIR, ruid);
  5826. @@ -727,7 +741,7 @@
  5827.      int ruid = 0;
  5828.  
  5829.      PRINTK("NFS call  statfs\n");
  5830. -    if (!(p0 = nfs_rpc_alloc()))
  5831. +    if (!(p0 = nfs_rpc_alloc(server->rsize)))
  5832.          return -EIO;
  5833.  retry:
  5834.      p = nfs_rpc_header(p0, NFSPROC_STATFS, ruid);
  5835. Only in linux.old/fs/nfs: symlink.c.orig
  5836. Only in linux.old/fs: open.c.orig
  5837. Only in linux.old/fs: pipe.c.orig
  5838. Only in linux.old/fs/proc: array.c.orig
  5839. Only in linux.old/fs/proc: fd.c.orig
  5840. Only in linux.old/fs/proc: inode.c.orig
  5841. Only in linux.old/fs/proc: link.c.orig
  5842. diff -u --new-file --recursive linux.old/fs/proc/net.c linux/fs/proc/net.c
  5843. --- linux.old/fs/proc/net.c    Fri May 20 18:47:34 1994
  5844. +++ linux/fs/proc/net.c    Fri May 20 18:49:36 1994
  5845. @@ -52,7 +52,17 @@
  5846.  extern int ipx_get_info(char *, char **, off_t, int);
  5847.  extern int ipx_rt_get_info(char *, char **, off_t, int);
  5848.  #endif /* CONFIG_IPX */
  5849. +#ifdef CONFIG_AX25
  5850. +extern int ax25_get_info(char *, char **, off_t, int);
  5851. +extern int ax25_rt_get_info(char *, char **, off_t, int);
  5852. +#ifdef CONFIG_NETROM
  5853. +extern int nr_get_info(char *, char **, off_t, int);
  5854. +extern int nr_nodes_get_info(char *, char **, off_t, int);
  5855. +extern int nr_neigh_get_info(char *, char **, off_t, int);
  5856. +#endif /* CONFIG_NETROM */
  5857. +#endif /* CONFIG_AX25 */
  5858.  
  5859. +
  5860.  static struct file_operations proc_net_operations = {
  5861.      NULL,            /* lseek - default */
  5862.      proc_readnet,        /* read - bad */
  5863. @@ -97,15 +107,24 @@
  5864.      { 131,3,"dev" },
  5865.      { 132,3,"raw" },
  5866.      { 133,3,"tcp" },
  5867. -    { 134,3,"udp" },
  5868. +    { 134,3,"udp" }
  5869.  #ifdef CONFIG_INET_RARP
  5870. -    { 135,4,"rarp"}
  5871. +    ,{ 135,4,"rarp"}
  5872.  #endif
  5873.  #endif    /* CONFIG_INET */
  5874.  #ifdef CONFIG_IPX
  5875.      ,{ 136,9,"ipx_route" },
  5876.      { 137,3,"ipx" }
  5877.  #endif /* CONFIG_IPX */
  5878. +#ifdef CONFIG_AX25
  5879. +    ,{ 138,10,"ax25_route" },
  5880. +    { 139,4,"ax25" }
  5881. +#ifdef CONFIG_NETROM
  5882. +    ,{ 140,8,"nr_nodes" },
  5883. +    { 141,8,"nr_neigh" },
  5884. +    { 142,2,"nr" }
  5885. +#endif /* CONFIG_NETROM */
  5886. +#endif /* CONFIG_AX25 */
  5887.  };
  5888.  
  5889.  #define NR_NET_DIRENTRY ((sizeof (net_dir))/(sizeof (net_dir[0])))
  5890. @@ -216,9 +235,11 @@
  5891.              case 134:
  5892.                  length = udp_get_info(page,&start,file->f_pos,thistime);
  5893.                  break;
  5894. +#ifdef CONFIG_INET_RARP                
  5895.              case 135:
  5896.                  length = rarp_get_info(page,&start,file->f_pos,thistime);
  5897.                  break;
  5898. +#endif /* CONFIG_INET_RARP */                
  5899.  #endif /* CONFIG_INET */
  5900.  #ifdef CONFIG_IPX
  5901.              case 136:
  5902. @@ -228,6 +249,26 @@
  5903.                  length = ipx_get_info(page,&start,file->f_pos,thistime);
  5904.                  break;
  5905.  #endif /* CONFIG_IPX */
  5906. +#ifdef CONFIG_AX25
  5907. +            case 138:
  5908. +                length = ax25_rt_get_info(page,&start,file->f_pos,thistime);
  5909. +                break;
  5910. +            case 139:
  5911. +                length = ax25_get_info(page,&start,file->f_pos,thistime);
  5912. +                break;
  5913. +#ifdef CONFIG_NETROM
  5914. +            case 140:
  5915. +                length = nr_nodes_get_info(page,&start,file->f_pos,thistime);
  5916. +                break;
  5917. +            case 141:
  5918. +                length = nr_neigh_get_info(page,&start,file->f_pos,thistime);
  5919. +                break;
  5920. +            case 142:
  5921. +                length = nr_get_info(page,&start,file->f_pos,thistime);
  5922. +                break;
  5923. +#endif /* CONFIG_NETROM */
  5924. +#endif /* CONFIG_AX25 */
  5925. +
  5926.              default:
  5927.                  free_page((unsigned long) page);
  5928.                  return -EBADF;
  5929. Only in linux.old/fs/proc: net.c.orig
  5930. Only in linux.old/fs/proc: root.c.orig
  5931. Only in linux.old/fs: read_write.c.o
  5932. Only in linux.old/fs: select.c.orig
  5933. Only in linux.old/fs: stat.c.orig
  5934. Only in linux.old/fs: super.c.orig
  5935. Only in linux.old/fs/sysv: balloc.c.orig
  5936. Only in linux.old/fs/sysv: file.c.orig
  5937. Only in linux.old/fs/sysv: ialloc.c.orig
  5938. Only in linux.old/fs/sysv: inode.c.orig
  5939. Only in linux.old/fs/sysv: namei.c.orig
  5940. Only in linux.old/fs/sysv: symlink.c.orig
  5941. Only in linux.old/fs/sysv: truncate.c.ori
  5942. Only in linux.old/fs/xiafs: bitmap.c.orig
  5943. Only in linux.old/fs/xiafs: file.c.orig
  5944. Only in linux.old/fs/xiafs: inode.c.orig
  5945. Only in linux.old/fs/xiafs: namei.c.orig
  5946. Only in linux.old/fs/xiafs: symlink.c.orig
  5947. Only in linux.old/fs/xiafs: truncate.c.ori
  5948. Only in linux.old/include/asm: segment.h.orig
  5949. diff -u --new-file --recursive linux.old/include/linux/autoconf.h linux/include/linux/autoconf.h
  5950. --- linux.old/include/linux/autoconf.h    Thu Jan  1 01:00:00 1970
  5951. +++ linux/include/linux/autoconf.h    Fri May 20 18:50:35 1994
  5952. @@ -0,0 +1,125 @@
  5953. +/*
  5954. + * Automatically generated C config: don't edit
  5955. + */
  5956. +
  5957. +/*
  5958. + * General setup
  5959. + */
  5960. +#define CONFIG_MATH_EMULATION 1
  5961. +#undef  CONFIG_BLK_DEV_HD
  5962. +#undef  CONFIG_BLK_DEV_XD
  5963. +#define CONFIG_NET 1
  5964. +#undef  CONFIG_MAX_16M
  5965. +#define CONFIG_SYSVIPC 1
  5966. +#undef  CONFIG_M486
  5967. +
  5968. +/*
  5969. + * Networking options
  5970. + */
  5971. +#define CONFIG_INET 1
  5972. +
  5973. +/*
  5974. + * (it is safe to leave these untouched)
  5975. + */
  5976. +#undef  CONFIG_INET_RARP
  5977. +#define CONFIG_INET_SNARL 1
  5978. +#undef  CONFIG_TCP_NAGLE_OFF
  5979. +#define CONFIG_IPX 1
  5980. +
  5981. +/*
  5982. + * Program binary formats
  5983. + */
  5984. +#undef  CONFIG_BINFMT_ELF
  5985. +#undef  CONFIG_BINFMT_COFF
  5986. +
  5987. +/*
  5988. + * SCSI support
  5989. + */
  5990. +#define CONFIG_SCSI 1
  5991. +
  5992. +/*
  5993. + * SCSI support type (disk, tape, CDrom)
  5994. + */
  5995. +#define CONFIG_BLK_DEV_SD 1
  5996. +#undef  CONFIG_CHR_DEV_ST
  5997. +#undef  CONFIG_BLK_DEV_SR
  5998. +#undef  CONFIG_CHR_DEV_SG
  5999. +
  6000. +/*
  6001. + * SCSI low-level drivers
  6002. + */
  6003. +#undef  CONFIG_SCSI_AHA152X
  6004. +#define CONFIG_SCSI_AHA1542 1
  6005. +#undef  CONFIG_SCSI_AHA1740
  6006. +#undef  CONFIG_SCSI_FUTURE_DOMAIN
  6007. +#undef  CONFIG_SCSI_GENERIC_NCR5380
  6008. +#undef  CONFIG_SCSI_PAS16
  6009. +#undef  CONFIG_SCSI_SEAGATE
  6010. +#undef  CONFIG_SCSI_T128
  6011. +#undef  CONFIG_SCSI_ULTRASTOR
  6012. +#undef  CONFIG_SCSI_7000FASST
  6013. +
  6014. +/*
  6015. + * Network device support
  6016. + */
  6017. +#define CONFIG_NETDEVICES 1
  6018. +#define CONFIG_SLIP 1
  6019. +#define SL_COMPRESSED 1
  6020. +#define CONFIG_SLAVE_BALANCING 1
  6021. +#undef  CONFIG_PLIP
  6022. +#undef  CONFIG_NE2000
  6023. +#undef  CONFIG_WD80x3
  6024. +#undef  CONFIG_ULTRA
  6025. +#undef  CONFIG_EL1
  6026. +#undef  CONFIG_EL2
  6027. +#undef  CONFIG_EL3
  6028. +#undef  CONFIG_HPLAN
  6029. +#define CONFIG_LANCE 1
  6030. +#undef  CONFIG_AT1700
  6031. +#undef  CONFIG_DEPCA
  6032. +#undef  CONFIG_DE600
  6033. +#undef  CONFIG_ATP
  6034. +
  6035. +/*
  6036. + * CD-ROM drivers
  6037. + */
  6038. +#undef  CONFIG_CDU31A
  6039. +#undef  CONFIG_MCD
  6040. +#undef  CONFIG_SBPCD
  6041. +
  6042. +/*
  6043. + * Filesystems
  6044. + */
  6045. +#define CONFIG_MINIX_FS 1
  6046. +#undef  CONFIG_EXT_FS
  6047. +#define CONFIG_EXT2_FS 1
  6048. +#undef  CONFIG_XIA_FS
  6049. +#define CONFIG_MSDOS_FS 1
  6050. +#define CONFIG_PROC_FS 1
  6051. +#define CONFIG_NFS_FS 1
  6052. +#undef  CONFIG_ISO9660_FS
  6053. +#undef  CONFIG_HPFS_FS
  6054. +#undef  CONFIG_SYSV_FS
  6055. +
  6056. +/*
  6057. + * character devices
  6058. + */
  6059. +#undef  CONFIG_PRINTER
  6060. +#undef  CONFIG_BUSMOUSE
  6061. +#undef  CONFIG_PSMOUSE
  6062. +#undef  CONFIG_MS_BUSMOUSE
  6063. +#undef  CONFIG_ATIXL_BUSMOUSE
  6064. +#define CONFIG_SELECTION 1
  6065. +#undef  CONFIG_TAPE_QIC02
  6066. +#undef  CONFIG_FTAPE
  6067. +
  6068. +/*
  6069. + * Sound
  6070. + */
  6071. +#undef  CONFIG_SOUND
  6072. +
  6073. +/*
  6074. + * Kernel hacking
  6075. + */
  6076. +#undef  CONFIG_PROFILE
  6077. +#define CONFIG_SCSI_CONSTANTS 1
  6078. diff -u --new-file --recursive linux.old/include/linux/ddi.h linux/include/linux/ddi.h
  6079. --- linux.old/include/linux/ddi.h    Wed Dec  1 12:44:15 1993
  6080. +++ linux/include/linux/ddi.h    Fri May 20 18:50:30 1994
  6081. @@ -1,79 +0,0 @@
  6082. -/*
  6083. - * ddi.h    Define the structure for linking in I/O drivers into the
  6084. - *        operating system kernel.  This method is currently only
  6085. - *        used by NET layer drivers, but it will be expanded into
  6086. - *        a link methos for ALL kernel-resident device drivers.
  6087. - *
  6088. - * Version:    @(#)ddi.h    1.0.2    04/22/93
  6089. - *
  6090. - * Author:    Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
  6091. - */
  6092. -#ifndef _LINUX_DDI_H
  6093. -#define _LINUX_DDI_H
  6094. -
  6095. -
  6096. -/* DDI control block flags. */
  6097. -#define DDI_FREADY    0x10000000    /* device is initialized    */
  6098. -#define DDI_FPRESENT    0x20000000    /* device hardware is present    */
  6099. -#define DDI_FBLKDEV    0x00000001    /* device has a BLK spec. file    */
  6100. -#define DDI_FCHRDEV    0x00000002    /* device has a CHR spec. file    */
  6101. -
  6102. -/* Various constants. */
  6103. -#define DDI_MAXNAME    16        /* length of a DDI ID string    */
  6104. -
  6105. -
  6106. -/* This structure is used to set up a DDI driver. */
  6107. -struct ddconf {
  6108. -  int        ioaddr;            /* main I/O (port) address    */
  6109. -  int        ioaux;            /* auxiliary I/O (HD, AST)    */
  6110. -  int        irq;            /* IRQ channel            */
  6111. -  int        dma;            /* DMA channel to use        */
  6112. -  unsigned long    memsize;        /* size of onboard memory    */
  6113. -  unsigned long    memaddr;        /* base address of memory    */
  6114. -};
  6115. -
  6116. -
  6117. -/* The DDI device control block. */
  6118. -struct ddi_device {
  6119. -  char        *title;            /* title of the driver        */
  6120. -  char        name[DDI_MAXNAME];    /* unit name of the I/O driver    */
  6121. -  short int    unit;            /* unit number of this driver    */
  6122. -  short int    nunits;            /* number of units in driver    */
  6123. -  int        (*init)(struct ddi_device *);    /* initialization func        */
  6124. -  int        (*handler)(int, ...);    /* command handler        */
  6125. -  short    int    major;            /* driver major dev number    */
  6126. -  short    int    minor;            /* driver minor dev number    */
  6127. -  unsigned long    flags;            /* various flags        */
  6128. -  struct ddconf config;            /* driver HW setup        */
  6129. -};
  6130. -
  6131. -
  6132. -/* This structure is used to set up networking protocols. */
  6133. -struct ddi_proto {
  6134. -  char        *name;            /* protocol name        */
  6135. -  void        (*init)(struct ddi_proto *);    /* initialization func    */
  6136. -};
  6137. -
  6138. -
  6139. -/* This structure is used to link a STREAMS interface. */
  6140. -struct iflink {
  6141. -  char        id[DDI_MAXNAME];    /* DDI ID string        */
  6142. -  char        stream[DDI_MAXNAME];    /* STREAMS interface name    */
  6143. -  int        family;            /* address (protocol) family    */
  6144. -  unsigned int    flags;            /* any flags needed (unused)    */
  6145. -};
  6146. -
  6147. -
  6148. -/* DDI control requests. */
  6149. -#define DDIOCSDBG    0x9000        /* set DDI debug level        */
  6150. -#define DDIOCGNAME    0x9001        /* get DDI ID name        */
  6151. -#define DDIOCGCONF    0x9002        /* get DDI HW config        */
  6152. -#define DDIOCSCONF    0x9003        /* set DDI HW config        */
  6153. -
  6154. -
  6155. -/* DDI global functions. */
  6156. -extern void            ddi_init(void);
  6157. -extern struct ddi_device    *ddi_map(const char *id);
  6158. -
  6159. -
  6160. -#endif    /* _LINUX_DDI_H */
  6161. Only in linux.old/include/linux: ext2_fs.h.orig
  6162. Only in linux.old/include/linux: fs.h.orig
  6163. diff -u --new-file --recursive linux.old/include/linux/if.h linux/include/linux/if.h
  6164. --- linux.old/include/linux/if.h    Fri May 20 18:42:35 1994
  6165. +++ linux/include/linux/if.h    Fri May 20 18:50:30 1994
  6166. @@ -31,11 +31,12 @@
  6167.  #define    IFF_NOTRAILERS    0x20        /* avoid use of trailers    */
  6168.  #define    IFF_RUNNING    0x40        /* resources allocated        */
  6169.  #define    IFF_NOARP    0x80        /* no ARP protocol        */
  6170. -
  6171. -/* These are not yet used: */
  6172.  #define    IFF_PROMISC    0x100        /* recve all packets        */
  6173. +/* These are not yet used: */
  6174.  #define    IFF_ALLMULTI    0x200        /* recve all multicast packets    */
  6175.  
  6176. +#define IFF_MASTER    0x400        /* master of a load balancer     */
  6177. +#define IFF_SLAVE    0x800        /* slave of a load balancer    */
  6178.  
  6179.  /*
  6180.   * The ifaddr structure contains information about one address
  6181. @@ -57,6 +58,26 @@
  6182.  #define    ifa_dstaddr    ifa_ifu.ifu_dstaddr    /* other end of link    */
  6183.  
  6184.  /*
  6185. + *    Device mapping structure. I'd just gone off and designed a 
  6186. + *    beautiful scheme using only loadable modules with arguments
  6187. + *    for driver options and along come the PCMICA people 8)
  6188. + *
  6189. + *    Ah well. The get() side of this is good for WDSETUP, and it'll
  6190. + *    be handy for debugging things. The set side is fine for now and
  6191. + *    being very small might be worth keeping for clean configuration.
  6192. + */
  6193. +
  6194. +struct ifmap {
  6195. +    unsigned long mem_start;
  6196. +    unsigned long mem_end;
  6197. +    unsigned short base_addr; 
  6198. +    unsigned char irq;
  6199. +    unsigned char dma;
  6200. +    unsigned char port;
  6201. +    /* 3 bytes spare */
  6202. +};
  6203. +
  6204. +/*
  6205.   * Interface request structure used for socket
  6206.   * ioctl's.  All interface ioctl's must have parameter
  6207.   * definitions which begin with ifr_name.  The
  6208. @@ -80,6 +101,8 @@
  6209.          short    ifru_flags;
  6210.          int    ifru_metric;
  6211.          int    ifru_mtu;
  6212. +        struct  ifmap ifru_map;
  6213. +        char    ifru_slave[IFNAMSIZ];    /* Just fits the size */
  6214.          caddr_t    ifru_data;
  6215.      } ifr_ifru;
  6216.  };
  6217. @@ -94,6 +117,8 @@
  6218.  #define    ifr_flags    ifr_ifru.ifru_flags    /* flags        */
  6219.  #define    ifr_metric    ifr_ifru.ifru_metric    /* metric        */
  6220.  #define    ifr_mtu        ifr_ifru.ifru_mtu    /* mtu            */
  6221. +#define ifr_map        ifr_ifru.ifru_map    /* device map        */
  6222. +#define ifr_slave    ifr_ifru.ifru_slave    /* slave device        */
  6223.  #define    ifr_data    ifr_ifru.ifru_data    /* for use by interface    */
  6224.  
  6225.  /*
  6226. Only in linux.old/include/linux: if.h.orig
  6227. diff -u --new-file --recursive linux.old/include/linux/if_arp.h linux/include/linux/if_arp.h
  6228. --- linux.old/include/linux/if_arp.h    Fri May 20 18:47:35 1994
  6229. +++ linux/include/linux/if_arp.h    Fri May 20 18:50:30 1994
  6230. @@ -35,7 +35,7 @@
  6231.  #define ARPHRD_CSLIP    257
  6232.  #define ARPHRD_SLIP6    258
  6233.  #define ARPHRD_CSLIP6    259
  6234. -#define ARPHRD_KISS    260
  6235. +#define ARPHRD_RSRVD    260        /* Notional KISS type         */
  6236.  #define ARPHRD_ADAPT    264
  6237.  
  6238.  /* ARP protocol opcodes. */
  6239. Only in linux.old/include/linux: if_arp.h.orig
  6240. diff -u --new-file --recursive linux.old/include/linux/if_ether.h linux/include/linux/if_ether.h
  6241. --- linux.old/include/linux/if_ether.h    Fri Feb 18 09:20:46 1994
  6242. +++ linux/include/linux/if_ether.h    Fri May 20 18:50:30 1994
  6243. @@ -40,6 +40,8 @@
  6244.  #define ETH_P_802_3    0x0001        /* Dummy type for 802.3 frames  */
  6245.  #define ETH_P_AX25    0x0002        /* Dummy protocol id for AX.25  */
  6246.  #define ETH_P_ALL    0x0003        /* Every packet (be careful!!!) */
  6247. +#define ETH_P_802_2    0x0004        /* 802.2 frames         */
  6248. +#define ETH_P_SNAP    0x0005        /* 802.2 SNAP frames          */
  6249.  
  6250.  /* This is an Ethernet frame header. */
  6251.  struct ethhdr {
  6252. Only in linux.old/include/linux: if_slip.h.orig
  6253. diff -u --new-file --recursive linux.old/include/linux/inet.h linux/include/linux/inet.h
  6254. --- linux.old/include/linux/inet.h    Fri May 20 18:42:36 1994
  6255. +++ linux/include/linux/inet.h    Fri May 20 18:50:33 1994
  6256. @@ -42,49 +42,19 @@
  6257.  #ifndef _LINUX_INET_H
  6258.  #define _LINUX_INET_H
  6259.  
  6260. -
  6261. -#include <linux/ddi.h>
  6262. -
  6263. -
  6264. -#undef    INET_DEBUG
  6265. -#ifdef    INET_DEBUG
  6266. -#  define    DPRINTF(x)    dprintf x 
  6267. -#else
  6268. -#   define    DPRINTF(x)    do ; while (0)
  6269. +#ifdef __i386__
  6270. +#define NET16(x)    ((((x) >> 8) & 0x00FF) | (((x) << 8) & 0xFF00))
  6271.  #endif
  6272. -
  6273. -/* Debug levels. One per module. */
  6274. -#define DBG_OFF        0            /* no debugging        */
  6275. -#define DBG_INET    1            /* sock.c        */
  6276. -#define DBG_RT        2            /* route.c        */
  6277. -#define DBG_DEV        3            /* dev.c        */
  6278. -#define DBG_ETH        4            /* eth.c        */
  6279. -#define DBG_PROTO    5            /* protocol.c        */
  6280. -#define DBG_TMR        6            /* timer.c        */
  6281. -#define DBG_PKT        7            /* packet.c        */
  6282. -#define DBG_RAW        8            /* raw.c        */
  6283. -
  6284. -#define DBG_LOOPB    10            /* loopback.c        */
  6285. -#define DBG_SLIP    11            /* slip.c        */
  6286. -
  6287. -#define DBG_ARP        20            /* arp.c        */
  6288. -#define DBG_IP        21            /* ip.c            */
  6289. -#define DBG_ICMP    22            /* icmp.c        */
  6290. -#define DBG_TCP        23            /* tcp.c        */
  6291. -#define DBG_UDP        24            /* udp.c        */
  6292. +#ifdef __mc680x0__
  6293. +#define NET16(x)    (x)
  6294. +#endif
  6295.  
  6296.  #ifdef __KERNEL__
  6297.  
  6298. -extern int        inet_debug;
  6299. -
  6300.  
  6301. -extern void        inet_proto_init(struct ddi_proto *pro);
  6302. +extern void        inet_proto_init(struct net_proto *pro);
  6303.  extern char        *in_ntoa(unsigned long in);
  6304.  extern unsigned long    in_aton(char *str);
  6305. -
  6306. -extern void        dprintf(int level, char *fmt, ...);
  6307. -
  6308. -extern int        dbg_ioctl(void *arg, int level);
  6309.  
  6310.  #endif
  6311.  #endif    /* _LINUX_INET_H */
  6312. Only in linux.old/include/linux: inet.h.orig
  6313. diff -u --new-file --recursive linux.old/include/linux/interrupt.h linux/include/linux/interrupt.h
  6314. --- linux.old/include/linux/interrupt.h    Sun May  8 03:20:37 1994
  6315. +++ linux/include/linux/interrupt.h    Fri May 20 18:50:29 1994
  6316. @@ -12,13 +12,14 @@
  6317.  extern struct bh_struct bh_base[32];
  6318.  
  6319.  /* Who gets which entry in bh_base.  Things which will occur most often
  6320. -   should come first. */
  6321. +   should come first - in which case NET should be up the top with SERIAL/TQUEUE! */
  6322. +   
  6323.  enum {
  6324.      TIMER_BH = 0,
  6325.      CONSOLE_BH,
  6326.      TQUEUE_BH,
  6327.      SERIAL_BH,
  6328. -    INET_BH,
  6329. +    NET_BH,
  6330.      KEYBOARD_BH
  6331.  };
  6332.  
  6333. diff -u --new-file --recursive linux.old/include/linux/interrupt.h.re linux/include/linux/interrupt.h.re
  6334. --- linux.old/include/linux/interrupt.h.re    Thu Jan  1 01:00:00 1970
  6335. +++ linux/include/linux/interrupt.h.re    Fri May 20 18:50:36 1994
  6336. @@ -0,0 +1,30 @@
  6337. +***************
  6338. +*** 12,24 ****
  6339. +  extern struct bh_struct bh_base[32];
  6340. +  
  6341. +  /* Who gets which entry in bh_base.  Things which will occur most often
  6342. +-    should come first. */
  6343. +  enum {
  6344. +      TIMER_BH = 0,
  6345. +      CONSOLE_BH,
  6346. +      TQUEUE_BH,
  6347. +      SERIAL_BH,
  6348. +-     INET_BH,
  6349. +      KEYBOARD_BH
  6350. +  };
  6351. +  
  6352. +--- 12,25 ----
  6353. +  extern struct bh_struct bh_base[32];
  6354. +  
  6355. +  /* Who gets which entry in bh_base.  Things which will occur most often
  6356. ++    should come first - in which case NET should be up the top with SERIAL/TQUEUE! */
  6357. ++    
  6358. +  enum {
  6359. +      TIMER_BH = 0,
  6360. +      CONSOLE_BH,
  6361. +      TQUEUE_BH,
  6362. +      SERIAL_BH,
  6363. ++     NET_BH,
  6364. +      KEYBOARD_BH
  6365. +  };
  6366. +  
  6367. Only in linux.old/include/linux: ip.h.orig
  6368. diff -u --new-file --recursive linux.old/include/linux/ipx.h linux/include/linux/ipx.h
  6369. --- linux.old/include/linux/ipx.h    Fri May 20 18:42:36 1994
  6370. +++ linux/include/linux/ipx.h    Fri May 20 18:50:33 1994
  6371. @@ -1,9 +1,13 @@
  6372. +#ifndef _IPX_H_
  6373. +#define _IPX_H_
  6374. +
  6375.  struct sockaddr_ipx
  6376.  {
  6377.      short sipx_family;
  6378.      unsigned long  sipx_network;
  6379.      unsigned char sipx_node[6];
  6380.      short sipx_port;
  6381. +    unsigned char    sipx_type;
  6382.  };
  6383.  
  6384.  struct ipx_route_def
  6385. @@ -14,10 +18,13 @@
  6386.      unsigned char ipx_router_node[6];
  6387.      unsigned char ipx_device[16];
  6388.      unsigned short ipx_flags;
  6389. +#define IPX_RT_SNAP        8
  6390. +#define IPX_RT_8022        4
  6391.  #define IPX_RT_BLUEBOOK        2
  6392.  #define IPX_RT_ROUTED        1
  6393.  };
  6394.  
  6395.  #define IPX_MTU        576
  6396.  
  6397. +#endif
  6398.  
  6399. Only in linux.old/include/linux: ipx.h.orig
  6400. Only in linux.old/include/linux: kernel.h.orig
  6401. Only in linux.old/include/linux: mm.h.orig
  6402. Only in linux.old/include/linux: mtio.h.orig
  6403. diff -u --new-file --recursive linux.old/include/linux/net.h linux/include/linux/net.h
  6404. --- linux.old/include/linux/net.h    Fri Mar 18 08:46:45 1994
  6405. +++ linux/include/linux/net.h    Fri May 20 18:50:30 1994
  6406. @@ -56,7 +56,7 @@
  6407.  
  6408.  
  6409.  /*
  6410. - * Internel representation of a socket. not all the fields are used by
  6411. + * Internal representation of a socket. not all the fields are used by
  6412.   * all configurations:
  6413.   *
  6414.   *        server            client
  6415. @@ -122,6 +122,10 @@
  6416.               unsigned long arg);    
  6417.  };
  6418.  
  6419. +struct net_proto {
  6420. +    char *name;        /* Protocol name */
  6421. +    void (*init_func)(struct net_proto *);    /* Bootstrap */
  6422. +};
  6423.  
  6424.  extern int    sock_awaitconn(struct socket *mysock, struct socket *servsock);
  6425.  extern int    sock_register(int family, struct proto_ops *ops);
  6426. diff -u --new-file --recursive linux.old/include/linux/netdevice.h linux/include/linux/netdevice.h
  6427. --- linux.old/include/linux/netdevice.h    Fri May 20 18:47:36 1994
  6428. +++ linux/include/linux/netdevice.h    Fri May 20 18:50:33 1994
  6429. @@ -12,6 +12,7 @@
  6430.   *        Corey Minyard <wf-rch!minyard@relay.EU.net>
  6431.   *        Donald J. Becker, <becker@super.org>
  6432.   *        Alan Cox, <A.Cox@swansea.ac.uk>
  6433. + *        Bjorn Ekwall. <bj0rn@blox.se>
  6434.   *
  6435.   *        This program is free software; you can redistribute it and/or
  6436.   *        modify it under the terms of the GNU General Public License
  6437. @@ -53,7 +54,7 @@
  6438.     */
  6439.    char              *name;
  6440.  
  6441. -  /* I/O specific fields.  */
  6442. +  /* I/O specific fields - FIXME: Merge these and struct ifmap into one */
  6443.    unsigned long          rmem_end;        /* shmem "recv" end    */
  6444.    unsigned long          rmem_start;        /* shmem "recv" start    */
  6445.    unsigned long          mem_end;        /* sahared mem end    */
  6446. @@ -105,6 +106,12 @@
  6447.    unsigned long          pa_dstaddr;    /* protocol P-P other side addr    */
  6448.    unsigned long          pa_mask;    /* protocol netmask        */
  6449.    unsigned short      pa_alen;    /* protocol address length    */
  6450. +  
  6451. +  /* For load balancing driver pair support */
  6452. +  
  6453. +  unsigned long           pkt_queue;    /* Packets queued */
  6454. +  struct device          *slave;    /* Slave device */
  6455. +  
  6456.  
  6457.    /* Pointer to the interface buffers. */
  6458.    struct sk_buff_head      buffs[DEV_NUMBUFFS];
  6459. @@ -132,6 +139,9 @@
  6460.    int              (*set_mac_address)(struct device *dev, void *addr);
  6461.  #define HAVE_PRIVATE_IOCTL
  6462.    int              (*do_ioctl)(struct device *dev, struct ifreq *ifr);
  6463. +#define HAVE_SET_CONFIG
  6464. +  int              (*set_config)(struct device *dev, struct ifmap *map);
  6465. +  
  6466.  };
  6467.  
  6468.  
  6469. @@ -175,8 +185,8 @@
  6470.  extern int        dev_rint(unsigned char *buff, long len, int flags,
  6471.                   struct device * dev);
  6472.  extern void        dev_transmit(void);
  6473. -extern int        in_inet_bh(void);
  6474. -extern void        inet_bh(void *tmp);
  6475. +extern int        in_net_bh(void);
  6476. +extern void        net_bh(void *tmp);
  6477.  extern void        dev_tint(struct device *dev);
  6478.  extern int        dev_get_info(char *buffer, char **start, off_t offset, int length);
  6479.  extern int        dev_ioctl(unsigned int cmd, void *);
  6480. @@ -186,6 +196,9 @@
  6481.  /* This function lives elsewhere (drivers/net/net_init.c but is related) */
  6482.  
  6483.  extern void        ether_setup(struct device *dev);
  6484. +/* Support for loadable net-drivers */
  6485. +extern int        register_netdev(struct device *dev);
  6486. +extern void        unregister_netdev(struct device *dev);
  6487.  
  6488.  #endif /* __KERNEL__ */
  6489.  
  6490. diff -u --new-file --recursive linux.old/include/linux/netdevice.h.ol linux/include/linux/netdevice.h.ol
  6491. --- linux.old/include/linux/netdevice.h.ol    Thu Jan  1 01:00:00 1970
  6492. +++ linux/include/linux/netdevice.h.ol    Fri May 20 18:50:36 1994
  6493. @@ -0,0 +1,192 @@
  6494. +/*
  6495. + * INET        An implementation of the TCP/IP protocol suite for the LINUX
  6496. + *        operating system.  INET is implemented using the  BSD Socket
  6497. + *        interface as the means of communication with the user level.
  6498. + *
  6499. + *        Definitions for the Interfaces handler.
  6500. + *
  6501. + * Version:    @(#)dev.h    1.0.10    08/12/93
  6502. + *
  6503. + * Authors:    Ross Biro, <bir7@leland.Stanford.Edu>
  6504. + *        Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  6505. + *        Corey Minyard <wf-rch!minyard@relay.EU.net>
  6506. + *        Donald J. Becker, <becker@super.org>
  6507. + *        Alan Cox, <A.Cox@swansea.ac.uk>
  6508. + *
  6509. + *        This program is free software; you can redistribute it and/or
  6510. + *        modify it under the terms of the GNU General Public License
  6511. + *        as published by the Free Software Foundation; either version
  6512. + *        2 of the License, or (at your option) any later version.
  6513. + *
  6514. + *        Moved to /usr/include/linux for NET3
  6515. + */
  6516. +#ifndef _LINUX_NETDEVICE_H
  6517. +#define _LINUX_NETDEVICE_H
  6518. +
  6519. +#include <linux/if.h>
  6520. +#include <linux/if_ether.h>
  6521. +#include <linux/skbuff.h>
  6522. +
  6523. +/* for future expansion when we will have different priorities. */
  6524. +#define DEV_NUMBUFFS    3
  6525. +#define MAX_ADDR_LEN    7
  6526. +#define MAX_HEADER    18
  6527. +
  6528. +#define IS_MYADDR    1        /* address is (one of) our own    */
  6529. +#define IS_LOOPBACK    2        /* address is for LOOPBACK    */
  6530. +#define IS_BROADCAST    3        /* address is a valid broadcast    */
  6531. +#define IS_INVBCAST    4        /* Wrong netmask bcast not for us (unused)*/
  6532. +
  6533. +/*
  6534. + * The DEVICE structure.
  6535. + * Actually, this whole structure is a big mistake.  It mixes I/O
  6536. + * data with strictly "high-level" data, and it has to know about
  6537. + * almost every data structure used in the INET module.  
  6538. + */
  6539. +struct device 
  6540. +{
  6541. +
  6542. +  /*
  6543. +   * This is the first field of the "visible" part of this structure
  6544. +   * (i.e. as seen by users in the "Space.c" file).  It is the name
  6545. +   * the interface.
  6546. +   */
  6547. +  char              *name;
  6548. +
  6549. +  /* I/O specific fields.  */
  6550. +  unsigned long          rmem_end;        /* shmem "recv" end    */
  6551. +  unsigned long          rmem_start;        /* shmem "recv" start    */
  6552. +  unsigned long          mem_end;        /* sahared mem end    */
  6553. +  unsigned long          mem_start;        /* shared mem start    */
  6554. +  unsigned short      base_addr;        /* device I/O address    */
  6555. +  unsigned char          irq;            /* device IRQ number    */
  6556. +
  6557. +  /* Low-level status flags. */
  6558. +  volatile unsigned char  start,        /* start an operation    */
  6559. +                          tbusy,        /* transmitter busy    */
  6560. +                          interrupt;        /* interrupt arrived    */
  6561. +
  6562. +  struct device          *next;
  6563. +
  6564. +  /* The device initialization function. Called only once. */
  6565. +  int              (*init)(struct device *dev);
  6566. +
  6567. +  /* Some hardware also needs these fields, but they are not part of the
  6568. +     usual set specified in Space.c. */
  6569. +  unsigned char          if_port;        /* Selectable AUI, TP,..*/
  6570. +  unsigned char          dma;            /* DMA channel        */
  6571. +
  6572. +  struct enet_statistics* (*get_stats)(struct device *dev);
  6573. +
  6574. +  /*
  6575. +   * This marks the end of the "visible" part of the structure. All
  6576. +   * fields hereafter are internal to the system, and may change at
  6577. +   * will (read: may be cleaned up at will).
  6578. +   */
  6579. +
  6580. +  /* These may be needed for future network-power-down code. */
  6581. +  unsigned long          trans_start;    /* Time (in jiffies) of last Tx    */
  6582. +  unsigned long          last_rx;    /* Time of last Rx        */
  6583. +
  6584. +  unsigned short      flags;    /* interface flags (a la BSD)    */
  6585. +  unsigned short      family;    /* address family ID (AF_INET)    */
  6586. +  unsigned short      metric;    /* routing metric (not used)    */
  6587. +  unsigned short      mtu;        /* interface MTU value        */
  6588. +  unsigned short      type;        /* interface hardware type    */
  6589. +  unsigned short      hard_header_len;    /* hardware hdr length    */
  6590. +  void              *priv;    /* pointer to private data    */
  6591. +
  6592. +  /* Interface address info. */
  6593. +  unsigned char          broadcast[MAX_ADDR_LEN];    /* hw bcast add    */
  6594. +  unsigned char          dev_addr[MAX_ADDR_LEN];    /* hw address    */
  6595. +  unsigned char          addr_len;    /* harfware address length    */
  6596. +  unsigned long          pa_addr;    /* protocol address        */
  6597. +  unsigned long          pa_brdaddr;    /* protocol broadcast addr    */
  6598. +  unsigned long          pa_dstaddr;    /* protocol P-P other side addr    */
  6599. +  unsigned long          pa_mask;    /* protocol netmask        */
  6600. +  unsigned short      pa_alen;    /* protocol address length    */
  6601. +
  6602. +  /* Pointer to the interface buffers. */
  6603. +  struct sk_buff_head      buffs[DEV_NUMBUFFS];
  6604. +
  6605. +  /* Pointers to interface service routines. */
  6606. +  int              (*open)(struct device *dev);
  6607. +  int              (*stop)(struct device *dev);
  6608. +  int              (*hard_start_xmit) (struct sk_buff *skb,
  6609. +                          struct device *dev);
  6610. +  int              (*hard_header) (unsigned char *buff,
  6611. +                      struct device *dev,
  6612. +                      unsigned short type,
  6613. +                      void *daddr,
  6614. +                      void *saddr,
  6615. +                      unsigned len,
  6616. +                      struct sk_buff *skb);
  6617. +  int              (*rebuild_header)(void *eth, struct device *dev,
  6618. +                unsigned long raddr, struct sk_buff *skb);
  6619. +  unsigned short      (*type_trans) (struct sk_buff *skb,
  6620. +                     struct device *dev);
  6621. +#define HAVE_MULTICAST             
  6622. +  void              (*set_multicast_list)(struct device *dev,
  6623. +                       int num_addrs, void *addrs);
  6624. +#define HAVE_SET_MAC_ADDR           
  6625. +  int              (*set_mac_address)(struct device *dev, void *addr);
  6626. +#define HAVE_PRIVATE_IOCTL
  6627. +  int              (*do_ioctl)(struct device *dev, struct ifreq *ifr);
  6628. +};
  6629. +
  6630. +
  6631. +struct packet_type {
  6632. +  unsigned short    type;    /* This is really htons(ether_type). */
  6633. +  unsigned short    copy:1;
  6634. +  int            (*func) (struct sk_buff *, struct device *,
  6635. +                 struct packet_type *);
  6636. +  void            *data;
  6637. +  struct packet_type    *next;
  6638. +};
  6639. +
  6640. +
  6641. +#ifdef __KERNEL__
  6642. +
  6643. +/* Used by dev_rint */
  6644. +#define IN_SKBUFF    1
  6645. +
  6646. +extern volatile char in_bh;
  6647. +
  6648. +extern struct device    *dev_base;
  6649. +extern struct packet_type *ptype_base;
  6650. +
  6651. +
  6652. +extern int        ip_addr_match(unsigned long addr1, unsigned long addr2);
  6653. +extern int        ip_chk_addr(unsigned long addr);
  6654. +extern struct device    *ip_dev_check(unsigned long daddr);
  6655. +extern unsigned long    ip_my_addr(void);
  6656. +extern unsigned long    ip_get_mask(unsigned long addr);
  6657. +
  6658. +extern void        dev_add_pack(struct packet_type *pt);
  6659. +extern void        dev_remove_pack(struct packet_type *pt);
  6660. +extern struct device    *dev_get(char *name);
  6661. +extern int        dev_open(struct device *dev);
  6662. +extern int        dev_close(struct device *dev);
  6663. +extern void        dev_queue_xmit(struct sk_buff *skb, struct device *dev,
  6664. +                       int pri);
  6665. +#define HAVE_NETIF_RX 1
  6666. +extern void        netif_rx(struct sk_buff *skb);
  6667. +/* The old interface to netif_rx(). */
  6668. +extern int        dev_rint(unsigned char *buff, long len, int flags,
  6669. +                 struct device * dev);
  6670. +extern void        dev_transmit(void);
  6671. +extern int        in_net_bh(void);
  6672. +extern void        net_bh(void *tmp);
  6673. +extern void        dev_tint(struct device *dev);
  6674. +extern int        dev_get_info(char *buffer, char **start, off_t offset, int length);
  6675. +extern int        dev_ioctl(unsigned int cmd, void *);
  6676. +
  6677. +extern void        dev_init(void);
  6678. +
  6679. +/* This function lives elsewhere (drivers/net/net_init.c but is related) */
  6680. +
  6681. +extern void        ether_setup(struct device *dev);
  6682. +
  6683. +#endif /* __KERNEL__ */
  6684. +
  6685. +#endif    /* _LINUX_DEV_H */
  6686. Only in linux.old/include/linux: netdevice.h.or
  6687. Only in linux.old/include/linux: ptrace.h.orig
  6688. diff -u --new-file --recursive linux.old/include/linux/route.h linux/include/linux/route.h
  6689. --- linux.old/include/linux/route.h    Sun Feb 13 15:16:51 1994
  6690. +++ linux/include/linux/route.h    Fri May 20 18:50:30 1994
  6691. @@ -44,14 +44,15 @@
  6692.      struct ifnet    *rt_ifp;
  6693.      short        rt_metric;    /* +1 for binary compatibility!    */
  6694.      char        *rt_dev;    /* forcing the device at add    */
  6695. +    unsigned long    rt_mtu;        /* per route MTU/Window */
  6696.  };
  6697.  
  6698.  
  6699. -#define    RTF_UP        0x0001        /* route useable        */
  6700. -#define    RTF_GATEWAY    0x0002        /* destination is a gateway    */
  6701. -#define    RTF_HOST    0x0004        /* host entry (net otherwise)    */
  6702. -#define RTF_REINSTATE    0x0008        /* re-instate route after tmout    */
  6703. -#define    RTF_DYNAMIC    0x0010        /* created dyn. (by redirect)    */
  6704. -#define    RTF_MODIFIED    0x0020        /* modified dyn. (by redirect)    */
  6705. -
  6706. +#define    RTF_UP        0x0001        /* route useable          */
  6707. +#define    RTF_GATEWAY    0x0002        /* destination is a gateway      */
  6708. +#define    RTF_HOST    0x0004        /* host entry (net otherwise)      */
  6709. +#define RTF_REINSTATE    0x0008        /* re-instate route after tmout      */
  6710. +#define    RTF_DYNAMIC    0x0010        /* created dyn. (by redirect)      */
  6711. +#define    RTF_MODIFIED    0x0020        /* modified dyn. (by redirect)      */
  6712. +#define RTF_MTU        0x0040        /* specific MSS for this route      */
  6713.  #endif    /* _LINUX_ROUTE_H */
  6714. Only in linux.old/include/linux: sbpcd.h.orig
  6715. Only in linux.old/include/linux: sched.h.orig
  6716. Only in linux.old/include/linux: signal.h.orig
  6717. diff -u --new-file --recursive linux.old/include/linux/skbuff.h linux/include/linux/skbuff.h
  6718. --- linux.old/include/linux/skbuff.h    Fri May 20 18:43:12 1994
  6719. +++ linux/include/linux/skbuff.h    Fri May 20 18:50:34 1994
  6720. @@ -70,6 +70,9 @@
  6721.                  arp;
  6722.    unsigned char            tries,lock,localroute;
  6723.    unsigned short        users;        /* User count - see datagram.c (and soon seqpacket.c/stream.c) */
  6724. +#ifdef CONFIG_SLAVE_BALANCING
  6725. +  unsigned short        in_dev_queue;
  6726. +#endif  
  6727.    unsigned long            padding[0];
  6728.    unsigned char            data[0];
  6729.  };
  6730. Only in linux.old/include/linux: skbuff.h.orig
  6731. Only in linux.old/include/linux: socket.h.orig
  6732. diff -u --new-file --recursive linux.old/include/linux/sockios.h linux/include/linux/sockios.h
  6733. --- linux.old/include/linux/sockios.h    Fri May 20 18:47:36 1994
  6734. +++ linux/include/linux/sockios.h    Fri May 20 18:50:30 1994
  6735. @@ -57,6 +57,8 @@
  6736.  #define SIOCGIFENCAP    0x8925        /* get/set slip encapsulation   */
  6737.  #define SIOCSIFENCAP    0x8926        
  6738.  #define SIOCGIFHWADDR    0x8927        /* Get hardware address        */
  6739. +#define SIOCGIFSLAVE    0x8929        /* Driver slaving support    */
  6740. +#define SIOCSIFSLAVE    0x8930
  6741.  
  6742.  /* Routing table calls (oldrtent - don't use) */
  6743.  #define SIOCADDRTOLD    0x8940        /* add routing table entry    */
  6744. @@ -71,6 +73,11 @@
  6745.  #define SIOCDRARP    0x8960        /* delete RARP table entry    */
  6746.  #define SIOCGRARP    0x8961        /* get RARP table entry        */
  6747.  #define SIOCSRARP    0x8962        /* set RARP table entry        */
  6748. +
  6749. +/* Driver configuration calls */
  6750. +
  6751. +#define SIOCGIFMAP    0x8970        /* Get device parameters    */
  6752. +#define SIOCSIFMAP    0x8971        /* Set device parameters    */
  6753.  
  6754.  /* Device private ioctl calls */
  6755.  
  6756. Only in linux.old/include/linux: sockios.h.orig
  6757. Only in linux.old/include/linux: soundcard.h.or
  6758. Only in linux.old/include/linux: sys.h.orig
  6759. Only in linux.old/include/linux: tcp.h.orig
  6760. Only in linux.old/include/linux: unistd.h.orig
  6761. Only in linux.old/include/linux: vm86.h.orig
  6762. Only in linux.old/init: main.c.orig
  6763. Only in linux.old/ipc: msg.c.orig
  6764. Only in linux.old/ipc: sem.c.orig
  6765. Only in linux.old/ipc: shm.c.orig
  6766. Only in linux.old/kernel: Makefile.orig
  6767. Only in linux.old/kernel: exit.c.orig
  6768. Only in linux.old/kernel: fork.c.orig
  6769. diff -u --new-file --recursive linux.old/kernel/ksyms.c linux/kernel/ksyms.c
  6770. --- linux.old/kernel/ksyms.c    Fri May 20 18:47:02 1994
  6771. +++ linux/kernel/ksyms.c    Fri May 20 18:50:13 1994
  6772. @@ -14,6 +14,9 @@
  6773.  #include <linux/ptrace.h>
  6774.  #include <linux/sys.h>
  6775.  #include <linux/utsname.h>
  6776. +#ifdef CONFIG_INET
  6777. +#include <linux/netdevice.h>
  6778. +#endif
  6779.    
  6780.  extern void *sys_call_table;
  6781.  
  6782. @@ -38,6 +41,19 @@
  6783.  
  6784.  extern void (* iABI_hook)(struct pt_regs * regs);
  6785.  #endif
  6786. +#ifdef CONFIG_INET
  6787. +extern int register_netdev(struct device *);
  6788. +extern void unregister_netdev(struct device *);
  6789. +extern void ether_setup(struct device *);
  6790. +extern struct sk_buff *alloc_skb(unsigned int,int);
  6791. +extern void kfree_skb(struct sk_buff *, int);
  6792. +extern void snarf_region(unsigned int, unsigned int);
  6793. +extern void netif_rx(struct sk_buff *);
  6794. +extern int dev_rint(unsigned char *, long, int, struct device *);
  6795. +extern void dev_tint(struct device *);
  6796. +extern struct device *irq2dev_map[];
  6797. +extern unsigned long bh_active;
  6798. +#endif
  6799.  
  6800.  struct {
  6801.      void *addr;
  6802. @@ -131,6 +147,21 @@
  6803.  
  6804.      /* Miscellaneous access points */
  6805.      X(si_meminfo),
  6806. +#endif
  6807. +
  6808. +#ifdef CONFIG_INET
  6809. +    /* support for loadable net drivers */
  6810. +    X(register_netdev),
  6811. +    X(unregister_netdev),
  6812. +    X(ether_setup),
  6813. +    X(alloc_skb),
  6814. +    X(kfree_skb),
  6815. +    X(snarf_region),
  6816. +    X(netif_rx),
  6817. +    X(dev_rint),
  6818. +    X(dev_tint),
  6819. +    X(irq2dev_map),
  6820. +    X(bh_active),
  6821.  #endif
  6822.  };
  6823.  
  6824. Only in linux.old/kernel: ksyms.c.orig
  6825. Only in linux.old/kernel: sched.c.orig
  6826. Only in linux.old/kernel: signal.c.orig
  6827. Only in linux.old/kernel: sys.c.orig
  6828. diff -u --new-file --recursive linux.old/kernel/sys_call.s linux/kernel/sys_call.s
  6829. --- linux.old/kernel/sys_call.s    Thu Jan  1 01:00:00 1970
  6830. +++ linux/kernel/sys_call.s    Fri May 20 18:50:15 1994
  6831. @@ -0,0 +1,546 @@
  6832. +# 1 "sys_call.S"
  6833. +
  6834. +
  6835. +
  6836. +
  6837. +
  6838. +
  6839. +
  6840. +
  6841. +
  6842. +
  6843. +
  6844. +
  6845. +
  6846. +
  6847. +
  6848. +
  6849. +
  6850. +
  6851. +
  6852. +
  6853. +
  6854. +
  6855. +
  6856. +
  6857. +
  6858. +
  6859. +
  6860. +
  6861. +
  6862. +
  6863. +
  6864. +
  6865. +
  6866. +
  6867. +
  6868. +
  6869. +
  6870. +
  6871. +
  6872. +
  6873. +
  6874. +
  6875. +# 1 "/usr/src/v11/linux/include/linux/segment.h" 1
  6876. +
  6877. +
  6878. +
  6879. +
  6880. +
  6881. +
  6882. +
  6883. +
  6884. +
  6885. +
  6886. +# 43 "sys_call.S" 2
  6887. +
  6888. +# 1 "/usr/src/v11/linux/include/linux/sys.h" 1
  6889. +
  6890. +
  6891. +
  6892. +
  6893. +
  6894. +
  6895. +
  6896. +
  6897. +
  6898. +
  6899. +
  6900. +
  6901. +
  6902. +
  6903. +
  6904. +
  6905. +
  6906. +
  6907. +# 29 "/usr/src/v11/linux/include/linux/sys.h"
  6908. +
  6909. +
  6910. +
  6911. +
  6912. +
  6913. +
  6914. +
  6915. +
  6916. +
  6917. +# 44 "sys_call.S" 2
  6918. +
  6919. +
  6920. +EBX        = 0x00
  6921. +ECX        = 0x04
  6922. +EDX        = 0x08
  6923. +ESI        = 0x0C
  6924. +EDI        = 0x10
  6925. +EBP        = 0x14
  6926. +EAX        = 0x18
  6927. +DS        = 0x1C
  6928. +ES        = 0x20
  6929. +FS        = 0x24
  6930. +GS        = 0x28
  6931. +ORIG_EAX    = 0x2C
  6932. +EIP        = 0x30
  6933. +CS        = 0x34
  6934. +EFLAGS        = 0x38
  6935. +OLDESP        = 0x3C
  6936. +OLDSS        = 0x40
  6937. +
  6938. +CF_MASK        = 0x00000001
  6939. +IF_MASK        = 0x00000200
  6940. +NT_MASK        = 0x00004000
  6941. +VM_MASK        = 0x00020000
  6942. +
  6943. +
  6944. +
  6945. +
  6946. +state        =  0
  6947. +counter        =  4
  6948. +priority    =  8
  6949. +signal        = 12
  6950. +blocked        = 16
  6951. +flags        = 20
  6952. +errno        = 24
  6953. +dbgreg6        = 52
  6954. +dbgreg7        = 56
  6955. +
  6956. +ENOSYS = 38
  6957. +
  6958. +.globl _system_call,_lcall7
  6959. +.globl _device_not_available, _coprocessor_error
  6960. +.globl _divide_error,_debug,_nmi,_int3,_overflow,_bounds,_invalid_op
  6961. +.globl _double_fault,_coprocessor_segment_overrun
  6962. +.globl _invalid_TSS,_segment_not_present,_stack_segment
  6963. +.globl _general_protection,_reserved
  6964. +.globl _alignment_check,_page_fault
  6965. +.globl ret_from_sys_call, _sys_call_table
  6966. +
  6967. +
  6968. +# 111 "sys_call.S"
  6969. +
  6970. +
  6971. +# 131 "sys_call.S"
  6972. +
  6973. +.align 4
  6974. +_lcall7:
  6975. +    pushfl            # We get a different stack layout with call gates,
  6976. +    pushl %eax        # which has to be cleaned up later..
  6977. +    cld; push %gs; push %fs; push %es; push %ds; pushl %eax; pushl %ebp; pushl %edi; pushl %esi; pushl %edx; pushl %ecx; pushl %ebx; movl $(0x18),%edx; mov %dx,%ds; mov %dx,%es; movl $(    0x2B),%edx; mov %dx,%fs;
  6978. +    movl EIP(%esp),%eax    # due to call gates, this is eflags, not eip..
  6979. +    movl CS(%esp),%edx    # this is eip..
  6980. +    movl EFLAGS(%esp),%ecx    # and this is cs..
  6981. +    movl %eax,EFLAGS(%esp)    #
  6982. +    movl %edx,EIP(%esp)    # Now we move them to their "normal" places
  6983. +    movl %ecx,CS(%esp)    #
  6984. +    movl %esp,%eax
  6985. +    pushl %eax
  6986. +    call _iABI_emulate
  6987. +    popl %eax
  6988. +    jmp ret_from_sys_call
  6989. +
  6990. +.align 4
  6991. +handle_bottom_half:
  6992. +    pushfl
  6993. +    incl _intr_count
  6994. +    sti
  6995. +    call _do_bottom_half
  6996. +    popfl
  6997. +    decl _intr_count
  6998. +    jmp 9f
  6999. +.align 4
  7000. +reschedule:
  7001. +    pushl $ret_from_sys_call
  7002. +    jmp _schedule
  7003. +.align 4
  7004. +_system_call:
  7005. +    pushl %eax            # save orig_eax
  7006. +    cld; push %gs; push %fs; push %es; push %ds; pushl %eax; pushl %ebp; pushl %edi; pushl %esi; pushl %edx; pushl %ecx; pushl %ebx; movl $(0x18),%edx; mov %dx,%ds; mov %dx,%es; movl $(    0x2B),%edx; mov %dx,%fs;
  7007. +    movl $-ENOSYS,EAX(%esp)
  7008. +    cmpl $(256),%eax
  7009. +    jae ret_from_sys_call
  7010. +    movl _sys_call_table(,%eax,4),%eax
  7011. +    testl %eax,%eax
  7012. +    je ret_from_sys_call
  7013. +    movl _current,%ebx
  7014. +    andl $~CF_MASK,EFLAGS(%esp)    # clear carry - assume no errors
  7015. +    movl $0,errno(%ebx)
  7016. +    movl %db6,%edx
  7017. +    movl %edx,dbgreg6(%ebx)  # save current hardware debugging status
  7018. +    testb $0x20,flags(%ebx)        # PF_TRACESYS
  7019. +    jne 1f
  7020. +    call *%eax
  7021. +    movl %eax,EAX(%esp)        # save the return value
  7022. +    movl errno(%ebx),%edx
  7023. +    negl %edx
  7024. +    je ret_from_sys_call
  7025. +    movl %edx,EAX(%esp)
  7026. +    orl $(CF_MASK),EFLAGS(%esp)    # set carry to indicate error
  7027. +    jmp ret_from_sys_call
  7028. +.align 4
  7029. +1:    call _syscall_trace
  7030. +    movl ORIG_EAX(%esp),%eax
  7031. +    call _sys_call_table(,%eax,4)
  7032. +    movl %eax,EAX(%esp)        # save the return value
  7033. +    movl _current,%eax
  7034. +    movl errno(%eax),%edx
  7035. +    negl %edx
  7036. +    je 1f
  7037. +    movl %edx,EAX(%esp)
  7038. +    orl $(CF_MASK),EFLAGS(%esp)    # set carry to indicate error
  7039. +1:    call _syscall_trace
  7040. +
  7041. +    .align 4,0x90
  7042. +ret_from_sys_call:
  7043. +    cmpl $0,_intr_count
  7044. +    jne 2f
  7045. +    movl _bh_mask,%eax
  7046. +    andl _bh_active,%eax
  7047. +    jne handle_bottom_half
  7048. +9:    movl EFLAGS(%esp),%eax        # check VM86 flag: CS/SS are
  7049. +    testl $(VM_MASK),%eax        # different then
  7050. +    jne 1f
  7051. +    cmpw $(0x10),CS(%esp)    # was old code segment supervisor ?
  7052. +    je 2f
  7053. +1:    sti
  7054. +    orl $(IF_MASK),%eax        # these just try to make sure
  7055. +    andl $~NT_MASK,%eax        # the program doesn't do anything
  7056. +    movl %eax,EFLAGS(%esp)        # stupid
  7057. +    cmpl $0,_need_resched
  7058. +    jne reschedule
  7059. +    movl _current,%eax
  7060. +    cmpl _task,%eax            # task[0] cannot have signals
  7061. +    je 2f
  7062. +    cmpl $0,state(%eax)        # state
  7063. +    jne reschedule
  7064. +    cmpl $0,counter(%eax)        # counter
  7065. +    je reschedule
  7066. +    movl blocked(%eax),%ecx
  7067. +    movl %ecx,%ebx            # save blocked in %ebx for signal handling
  7068. +    notl %ecx
  7069. +    andl signal(%eax),%ecx
  7070. +    jne signal_return
  7071. +2:    cmpw $(0x10),CS(%esp); je 1f; movl _current,%eax; movl dbgreg7(%eax),%ebx; movl %ebx,%db7;    1:    popl %ebx; popl %ecx; popl %edx; popl %esi; popl %edi; popl %ebp; popl %eax; pop %ds; pop %es; pop %fs; pop %gs; addl $4,%esp; iret
  7072. +.align 4
  7073. +signal_return:
  7074. +    movl %esp,%ecx
  7075. +    pushl %ecx
  7076. +    testl $(VM_MASK),EFLAGS(%ecx)
  7077. +    jne v86_signal_return
  7078. +    pushl %ebx
  7079. +    call _do_signal
  7080. +    popl %ebx
  7081. +    popl %ebx
  7082. +    cmpw $(0x10),CS(%esp); je 1f; movl _current,%eax; movl dbgreg7(%eax),%ebx; movl %ebx,%db7;    1:    popl %ebx; popl %ecx; popl %edx; popl %esi; popl %edi; popl %ebp; popl %eax; pop %ds; pop %es; pop %fs; pop %gs; addl $4,%esp; iret
  7083. +.align 4
  7084. +v86_signal_return:
  7085. +    call _save_v86_state
  7086. +    movl %eax,%esp
  7087. +    pushl %eax
  7088. +    pushl %ebx
  7089. +    call _do_signal
  7090. +    popl %ebx
  7091. +    popl %ebx
  7092. +    cmpw $(0x10),CS(%esp); je 1f; movl _current,%eax; movl dbgreg7(%eax),%ebx; movl %ebx,%db7;    1:    popl %ebx; popl %ecx; popl %edx; popl %esi; popl %edi; popl %ebp; popl %eax; pop %ds; pop %es; pop %fs; pop %gs; addl $4,%esp; iret
  7093. +
  7094. +.align 4
  7095. +_divide_error:
  7096. +    pushl $0        # no error code
  7097. +    pushl $_do_divide_error
  7098. +.align 4,0x90
  7099. +error_code:
  7100. +    push %fs
  7101. +    push %es
  7102. +    push %ds
  7103. +    pushl %eax
  7104. +    pushl %ebp
  7105. +    pushl %edi
  7106. +    pushl %esi
  7107. +    pushl %edx
  7108. +    pushl %ecx
  7109. +    pushl %ebx
  7110. +    movl $0,%eax
  7111. +    movl %eax,%db7            # disable hardware debugging...
  7112. +    cld
  7113. +    movl $-1, %eax
  7114. +    xchgl %eax, ORIG_EAX(%esp)    # orig_eax (get the error code. )
  7115. +    xorl %ebx,%ebx            # zero ebx
  7116. +    mov %gs,%bx            # get the lower order bits of gs
  7117. +    xchgl %ebx, GS(%esp)        # get the address and save gs.
  7118. +    pushl %eax            # push the error code
  7119. +    lea 4(%esp),%edx
  7120. +    pushl %edx
  7121. +    movl $(0x18),%edx
  7122. +    mov %dx,%ds
  7123. +    mov %dx,%es
  7124. +    movl $(    0x2B),%edx
  7125. +    mov %dx,%fs
  7126. +    pushl %eax
  7127. +    movl _current,%eax
  7128. +    movl %db6,%edx
  7129. +    movl %edx,dbgreg6(%eax)  # save current hardware debugging status
  7130. +    popl %eax
  7131. +    call *%ebx
  7132. +    addl $8,%esp
  7133. +    jmp ret_from_sys_call
  7134. +
  7135. +.align 4
  7136. +_coprocessor_error:
  7137. +    pushl $0
  7138. +    pushl $_do_coprocessor_error
  7139. +    jmp error_code
  7140. +
  7141. +.align 4
  7142. +_device_not_available:
  7143. +    pushl $-1        # mark this as an int
  7144. +    cld; push %gs; push %fs; push %es; push %ds; pushl %eax; pushl %ebp; pushl %edi; pushl %esi; pushl %edx; pushl %ecx; pushl %ebx; movl $(0x18),%edx; mov %dx,%ds; mov %dx,%es; movl $(    0x2B),%edx; mov %dx,%fs;
  7145. +    pushl $ret_from_sys_call
  7146. +    movl %cr0,%eax
  7147. +    testl $0x4,%eax            # EM (math emulation bit)
  7148. +    je _math_state_restore
  7149. +    pushl $0        # temporary storage for ORIG_EIP
  7150. +    call _math_emulate
  7151. +    addl $4,%esp
  7152. +    ret
  7153. +
  7154. +.align 4
  7155. +_debug:
  7156. +    pushl $0
  7157. +    pushl $_do_debug
  7158. +    jmp error_code
  7159. +
  7160. +.align 4
  7161. +_nmi:
  7162. +    pushl $0
  7163. +    pushl $_do_nmi
  7164. +    jmp error_code
  7165. +
  7166. +.align 4
  7167. +_int3:
  7168. +    pushl $0
  7169. +    pushl $_do_int3
  7170. +    jmp error_code
  7171. +
  7172. +.align 4
  7173. +_overflow:
  7174. +    pushl $0
  7175. +    pushl $_do_overflow
  7176. +    jmp error_code
  7177. +
  7178. +.align 4
  7179. +_bounds:
  7180. +    pushl $0
  7181. +    pushl $_do_bounds
  7182. +    jmp error_code
  7183. +
  7184. +.align 4
  7185. +_invalid_op:
  7186. +    pushl $0
  7187. +    pushl $_do_invalid_op
  7188. +    jmp error_code
  7189. +
  7190. +.align 4
  7191. +_coprocessor_segment_overrun:
  7192. +    pushl $0
  7193. +    pushl $_do_coprocessor_segment_overrun
  7194. +    jmp error_code
  7195. +
  7196. +.align 4
  7197. +_reserved:
  7198. +    pushl $0
  7199. +    pushl $_do_reserved
  7200. +    jmp error_code
  7201. +
  7202. +.align 4
  7203. +_double_fault:
  7204. +    pushl $_do_double_fault
  7205. +    jmp error_code
  7206. +
  7207. +.align 4
  7208. +_invalid_TSS:
  7209. +    pushl $_do_invalid_TSS
  7210. +    jmp error_code
  7211. +
  7212. +.align 4
  7213. +_segment_not_present:
  7214. +    pushl $_do_segment_not_present
  7215. +    jmp error_code
  7216. +
  7217. +.align 4
  7218. +_stack_segment:
  7219. +    pushl $_do_stack_segment
  7220. +    jmp error_code
  7221. +
  7222. +.align 4
  7223. +_general_protection:
  7224. +    pushl $_do_general_protection
  7225. +    jmp error_code
  7226. +
  7227. +.align 4
  7228. +_alignment_check:
  7229. +    pushl $_do_alignment_check
  7230. +    jmp error_code
  7231. +
  7232. +.align 4
  7233. +_page_fault:
  7234. +    pushl $_do_page_fault
  7235. +    jmp error_code
  7236. +
  7237. +.data
  7238. +.align 4
  7239. +_sys_call_table:
  7240. +    .long _sys_setup        
  7241. +    .long _sys_exit
  7242. +    .long _sys_fork
  7243. +    .long _sys_read
  7244. +    .long _sys_write
  7245. +    .long _sys_open            
  7246. +    .long _sys_close
  7247. +    .long _sys_waitpid
  7248. +    .long _sys_creat
  7249. +    .long _sys_link
  7250. +    .long _sys_unlink        
  7251. +    .long _sys_execve
  7252. +    .long _sys_chdir
  7253. +    .long _sys_time
  7254. +    .long _sys_mknod
  7255. +    .long _sys_chmod        
  7256. +    .long _sys_chown
  7257. +    .long _sys_break
  7258. +    .long _sys_stat
  7259. +    .long _sys_lseek
  7260. +    .long _sys_getpid        
  7261. +    .long _sys_mount
  7262. +    .long _sys_umount
  7263. +    .long _sys_setuid
  7264. +    .long _sys_getuid
  7265. +    .long _sys_stime        
  7266. +    .long _sys_ptrace
  7267. +    .long _sys_alarm
  7268. +    .long _sys_fstat
  7269. +    .long _sys_pause
  7270. +    .long _sys_utime        
  7271. +    .long _sys_stty
  7272. +    .long _sys_gtty
  7273. +    .long _sys_access
  7274. +    .long _sys_nice
  7275. +    .long _sys_ftime        
  7276. +    .long _sys_sync
  7277. +    .long _sys_kill
  7278. +    .long _sys_rename
  7279. +    .long _sys_mkdir
  7280. +    .long _sys_rmdir        
  7281. +    .long _sys_dup
  7282. +    .long _sys_pipe
  7283. +    .long _sys_times
  7284. +    .long _sys_prof
  7285. +    .long _sys_brk            
  7286. +    .long _sys_setgid
  7287. +    .long _sys_getgid
  7288. +    .long _sys_signal
  7289. +    .long _sys_geteuid
  7290. +    .long _sys_getegid        
  7291. +    .long _sys_acct
  7292. +    .long _sys_phys
  7293. +    .long _sys_lock
  7294. +    .long _sys_ioctl
  7295. +    .long _sys_fcntl        
  7296. +    .long _sys_mpx
  7297. +    .long _sys_setpgid
  7298. +    .long _sys_ulimit
  7299. +    .long _sys_olduname
  7300. +    .long _sys_umask        
  7301. +    .long _sys_chroot
  7302. +    .long _sys_ustat
  7303. +    .long _sys_dup2
  7304. +    .long _sys_getppid
  7305. +    .long _sys_getpgrp        
  7306. +    .long _sys_setsid
  7307. +    .long _sys_sigaction
  7308. +    .long _sys_sgetmask
  7309. +    .long _sys_ssetmask
  7310. +    .long _sys_setreuid        
  7311. +    .long _sys_setregid
  7312. +    .long _sys_sigsuspend
  7313. +    .long _sys_sigpending
  7314. +    .long _sys_sethostname
  7315. +    .long _sys_setrlimit        
  7316. +    .long _sys_getrlimit
  7317. +    .long _sys_getrusage
  7318. +    .long _sys_gettimeofday
  7319. +    .long _sys_settimeofday
  7320. +    .long _sys_getgroups        
  7321. +    .long _sys_setgroups
  7322. +    .long _sys_select
  7323. +    .long _sys_symlink
  7324. +    .long _sys_lstat
  7325. +    .long _sys_readlink        
  7326. +    .long _sys_uselib
  7327. +    .long _sys_swapon
  7328. +    .long _sys_reboot
  7329. +    .long _sys_readdir
  7330. +    .long _sys_mmap            
  7331. +    .long _sys_munmap
  7332. +    .long _sys_truncate
  7333. +    .long _sys_ftruncate
  7334. +    .long _sys_fchmod
  7335. +    .long _sys_fchown        
  7336. +    .long _sys_getpriority
  7337. +    .long _sys_setpriority
  7338. +    .long _sys_profil
  7339. +    .long _sys_statfs
  7340. +    .long _sys_fstatfs        
  7341. +    .long _sys_ioperm
  7342. +    .long _sys_socketcall
  7343. +    .long _sys_syslog
  7344. +    .long _sys_setitimer
  7345. +    .long _sys_getitimer        
  7346. +    .long _sys_newstat
  7347. +    .long _sys_newlstat
  7348. +    .long _sys_newfstat
  7349. +    .long _sys_uname
  7350. +    .long _sys_iopl            
  7351. +    .long _sys_vhangup
  7352. +    .long _sys_idle
  7353. +    .long _sys_vm86
  7354. +    .long _sys_wait4
  7355. +    .long _sys_swapoff        
  7356. +    .long _sys_sysinfo
  7357. +    .long _sys_ipc
  7358. +    .long _sys_fsync
  7359. +    .long _sys_sigreturn
  7360. +    .long _sys_fork        
  7361. +    .long _sys_setdomainname
  7362. +    .long _sys_newuname
  7363. +    .long _sys_modify_ldt
  7364. +    .long _sys_adjtimex
  7365. +    .long _sys_mprotect        
  7366. +    .long _sys_sigprocmask
  7367. +    .long _sys_create_module
  7368. +    .long _sys_init_module
  7369. +    .long _sys_delete_module
  7370. +    .long _sys_get_kernel_syms    
  7371. +    .long _sys_ni_syscall
  7372. +    .long _sys_getpgid
  7373. +    .long _sys_fchdir
  7374. +    .long _sys_bdflush
  7375. +    .long _sys_sysfs        
  7376. +
  7377. +    .space (256-135)*4
  7378. Only in linux.old/kernel: traps.c.orig
  7379. Only in linux.old/kernel: vm86.c.orig
  7380. Only in linux.old/lib: string.c.orig
  7381. Only in linux.old/mm: memory.c.orig
  7382. Only in linux.old/mm: mmap.c.orig
  7383. Only in linux.old/mm: swap.c.orig
  7384. diff -u --new-file --recursive linux.old/modules/NET_MODULES linux/modules/NET_MODULES
  7385. --- linux.old/modules/NET_MODULES    Thu Jan  1 01:00:00 1970
  7386. +++ linux/modules/NET_MODULES    Fri May 20 18:51:57 1994
  7387. @@ -0,0 +1 @@
  7388. +3c509.o de600.o
  7389. diff -u --new-file --recursive linux.old/net/Makefile linux/net/Makefile
  7390. --- linux.old/net/Makefile    Wed Dec  1 12:44:15 1993
  7391. +++ linux/net/Makefile    Fri May 20 18:50:37 1994
  7392. @@ -21,7 +21,7 @@
  7393.  .c.s:
  7394.      $(CC) $(CFLAGS) -S $<
  7395.  
  7396. -OBJS    =  Space.o ddi.o socket.o
  7397. +OBJS    =  socket.o protocols.o
  7398.  
  7399.  all:        subdirs net.o
  7400.  
  7401. diff -u --new-file --recursive linux.old/net/Space.c linux/net/Space.c
  7402. --- linux.old/net/Space.c    Fri May 20 18:42:37 1994
  7403. +++ linux/net/Space.c    Fri May 20 18:50:37 1994
  7404. @@ -1,59 +0,0 @@
  7405. -/*
  7406. - * Space.c    Defines which protocol modules and I/O device drivers get
  7407. - *        linked into the LINUX kernel.  Currently, this is only used
  7408. - *        by the NET layer of LINUX, but it eventually might move to
  7409. - *        an upper directory of the system.
  7410. - *
  7411. - * Version:    @(#)Space.c    1.0.2    04/22/93
  7412. - *
  7413. - * Author:    Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
  7414. - *
  7415. - *    Please see the comments in ddi.c - Alan
  7416. - * 
  7417. - */
  7418. -#include <linux/config.h>
  7419. -#include <linux/types.h>
  7420. -#include <linux/kernel.h>
  7421. -#include <linux/ddi.h>
  7422. -
  7423. -
  7424. -#define CONFIG_UNIX        YES        /* always present...    */
  7425. -
  7426. -
  7427. -/*
  7428. - * Section A:    Networking Protocol Handlers.
  7429. - *        This section defines which networking protocols get
  7430. - *        linked into the SOCKET layer of the Linux kernel.
  7431. - *        Currently, these are AF_UNIX (always) and AF_INET.
  7432. - */
  7433. -#ifdef    CONFIG_UNIX
  7434. -#  include "unix/unix.h"
  7435. -#endif
  7436. -#ifdef    CONFIG_INET
  7437. -#  include <linux/inet.h>
  7438. -#endif
  7439. -#ifdef CONFIG_IPX
  7440. -#include "inet/ipxcall.h"
  7441. -#endif
  7442. -#ifdef CONFIG_AX25
  7443. -#include "inet/ax25call.h"
  7444. -#endif
  7445. -
  7446. -struct ddi_proto protocols[] = {
  7447. -#ifdef    CONFIG_UNIX
  7448. -  { "UNIX",    unix_proto_init    },
  7449. -#endif
  7450. -#ifdef  CONFIG_IPX
  7451. -  { "IPX",    ipx_proto_init },
  7452. -#endif
  7453. -#ifdef CONFIG_AX25  
  7454. -  { "AX.25",    ax25_proto_init },
  7455. -#endif  
  7456. -#ifdef    CONFIG_INET
  7457. -  { "INET",    inet_proto_init    },
  7458. -#endif
  7459. -  { NULL,    NULL        }
  7460. -};
  7461. -
  7462. -
  7463. Only in linux.old/net: Space.c.orig
  7464. Only in linux.old/net: ddi.c
  7465. Only in linux.old/net: ddi.c.orig
  7466. diff -u --new-file --recursive linux.old/net/inet/Makefile linux/net/inet/Makefile
  7467. --- linux.old/net/inet/Makefile    Fri May 20 18:42:37 1994
  7468. +++ linux/net/inet/Makefile    Fri May 20 18:50:37 1994
  7469. @@ -15,23 +15,38 @@
  7470.      $(CC) $(CFLAGS) -S -o $*.s $<
  7471.  
  7472.  
  7473. -OBJS    = sock.o utils.o route.o proc.o timer.o protocol.o \
  7474. -      eth.o packet.o arp.o dev.o ip.o raw.o icmp.o tcp.o udp.o \
  7475. -      datagram.o skbuff.o devinet.o
  7476. +#OBJS    = sock.o utils.o route.o proc.o timer.o protocol.o \
  7477. +#      eth.o packet.o arp.o dev.o ip.o raw.o icmp.o tcp.o udp.o \
  7478. +#      datagram.o skbuff.o devinet.o
  7479.  
  7480. +OBJS    := sock.o eth.o dev.o skbuff.o datagram.o
  7481. +
  7482. +ifdef CONFIG_INET
  7483. +
  7484. +OBJS    := $(OBJS) utils.o route.o proc.o timer.o protocol.o packet.o \
  7485. +           arp.o ip.o raw.o icmp.o tcp.o udp.o devinet.o af_inet.o
  7486. +
  7487. +endif
  7488. +
  7489. +ifdef CONFIG_INET_RARP
  7490. +
  7491. +OBJS    := $(OBJS) rarp.o
  7492. +
  7493. +endif
  7494. +
  7495.  ifdef CONFIG_AX25
  7496.  
  7497. -OBJS    := $(OBJS) ax25.o ax25_in.o ax25_out.o ax25_subr.o ax25_timer.o
  7498. +OBJS    := $(OBJS) ax25.o ax25_in.o ax25_out.o ax25_route.o ax25_subr.o ax25_timer.o
  7499.  
  7500.  endif
  7501.  
  7502.  ifdef CONFIG_IPX
  7503.  
  7504. -OBJS    := $(OBJS) ipx.o
  7505. +OBJS    := $(OBJS) ipx.o pe2.o p8022.o p8023.o
  7506.  
  7507.  endif
  7508.  
  7509. -ifdef CONFIG_INET
  7510. +ifdef CONFIG_NET
  7511.  
  7512.  inet.o:        $(OBJS)
  7513.          $(LD) -r -o inet.o $(OBJS)
  7514. Only in linux.old/net/inet: Makefile.orig
  7515. diff -u --new-file --recursive linux.old/net/inet/README linux/net/inet/README
  7516. --- linux.old/net/inet/README    Fri May 20 18:42:37 1994
  7517. +++ linux/net/inet/README    Fri May 20 18:50:41 1994
  7518. @@ -1,92 +1,37 @@
  7519. +This is snapshot 014
  7520.  
  7521. -This is snapshot 010
  7522. +This fixes the following from the 1.1.12 release (see the relevant files
  7523. +for the credits to authors).
  7524.  
  7525. -Notes:
  7526. -ARP
  7527. -    As of snapshot 006, ARP should compile and work correctly
  7528. -    for any protocol that has the right build_header support.
  7529. -
  7530. -AX25    
  7531. -    This is an ALPHA release. It will not be a standard part
  7532. -    of the real release module. Please read the copyrights on
  7533. -    the AX.25 code carefully. When AX.25 is finished it will
  7534. -    be part of a seperatly available amateur radio add on. Also
  7535. -    please rememeber this is ALPHA code. It works well for a lot
  7536. -    of people but I know for a fact it is currently buggy.
  7537. -
  7538. -IPX
  7539. -    The IPX module in here is fairly complete, and certainly
  7540. -    usable for things. The IPX user code isn't yet very useful
  7541. -    (nobody has written a RIP/SAP daemon!).
  7542. -
  7543. -NetROM
  7544. -    I'm slowly doing bits of this code, but its not even fit
  7545. -    to include here.
  7546. -
  7547. -
  7548. -Status:
  7549. -
  7550. -Done:
  7551. -    Replaced ARP with Florian la Roche's ARP.
  7552. -    Replaced/improved sk_buff handlers (again from Florian)
  7553. -    Removed surplus DDI code.
  7554. -    Reformatted most modules.
  7555. -    Fixed ICMP handling bugs (ICMP error to ICMP error).
  7556. -    Fixed fragmentation bugs (both memory and mtu).
  7557. -    Moved some includes.
  7558. -    Drivers now build correctly with no IP layer.
  7559. -    Merged Linus 1.0.1 diffs and my patches 1-3.
  7560. -    Further fixups on clean driver build.
  7561. -    Loopback driver now lives where it belongs.
  7562. -    UDP verified against specification (passes).
  7563. -    IP verified against specification (two errors: Incorrect forwarding and
  7564. -        no mandatory option handling).
  7565. -    ARP verified against specification (passes: recommendation that ARP
  7566. -        rejects MAC broadcast/multicast addresses - this needs
  7567. -        driver changes doing).
  7568. -    All surplus skb->sk assignment and skb->mem_len skb->mem_addr removed.
  7569. -    eth.h became linux/etherdevice.h.
  7570. -    alloc_skb nows adds the sizeof(struct sk_buff) itself.
  7571. -    Now relative to Linux 1.0.4.
  7572. -    All IP wakeups are now callbacks.
  7573. -    IPX and AX.25 callbacks now use wake_up_interruptible correctly.
  7574. -    ICMP,IP and UDP collect snmp statistics.
  7575. -    Removed the 4K limit from the /proc/net/* files.
  7576. -    Routing bugs.
  7577. -    Cleaned up skb duplication.
  7578. -    IPX /proc from Mark Evans.
  7579. -    Driver packet ordering now enforced.
  7580. -    AX.25 unused SSID bits now set.
  7581. -
  7582. -In Progress:
  7583. -    Module by module validation against specifications.
  7584. -    TCP delayed ACK     [RFC1122 requires this].
  7585. -    Byte-order fixes.
  7586. -    Core code restructure to enable a working non IP build
  7587. -    Trying to fix /proc to do >4K correctly, as well as dynamic addition
  7588. -         of /proc/ and /proc/net/ objects (for module protocol layers).
  7589. -    Adding the extra NET2E driver ioctl() support.
  7590. -    SNMP MIB statistic capture - finish TCP and add device layer when 
  7591. -        Donald is ready.
  7592. -    Donald Beckers latest driver mods.
  7593. -    Adding the ICMP_TIMESTAMP support patch.
  7594. -    Routing bugs.
  7595. -    Packet level time stamping.
  7596. -    Merging in support for the I^2IT 'TICK' time synchronisation chip.
  7597. -    Crynwyr compliant PLIP driver.
  7598. -
  7599. -To Do:
  7600. -    Merge in sk_buff data handling module.
  7601. -    Socket family/protocol seperation.
  7602. -    Additional BSD options (SO_LOWAT etc).
  7603. -    IP option handling, especially on ip forwards.
  7604. -    AX.25 /proc support.
  7605. -    SNMP /proc support.
  7606. -    TCP MSS/Window and route metrics in the routing table.
  7607. -    TCP mtu discovery support.
  7608. -    NetROM.
  7609. -    TCP closing side state machine bug fixes.
  7610. -    NetBEUI (Lan Manager) [ie IEE802.3/IEE802.2/NetBIOS].
  7611. -    Make drivers record type and addressing category(Multicast/Broadcast..)
  7612. -    Speed it up.
  7613. -    Unix domain cleanup/rewrite.
  7614. +o    RARP compiles in properly
  7615. +o    Using new Tytso TTY drivers
  7616. +o    IP forwarding is configurable
  7617. +o    PC/TCP support
  7618. +o    AX.25 builds fine without SLIP driver (just PI)
  7619. +o    MTU recognized in routing table (but only by TCP currently)
  7620. +o    AX.25 PI driver merged into AX.25 code and kernel stubs
  7621. +o    UNIX /proc trap hopefully fixed
  7622. +o    DDI removed totally ready to use the PCMICA people's stuff
  7623. +o    Unix domain lock/unlock now static (needlessly visible before)
  7624. +o    Split net/inet/sock.c into generic and IP components
  7625. +o    NFS client works correctly with 8K NFS
  7626. +o    Non IP builds work correctly
  7627. +o    Renamed inet_bh etc to net_bh to reflect true nature
  7628. +o    TCP handling of poor routes much improved
  7629. +o    TCP connect timing fixed
  7630. +o    Incredibly unlikely SLIP memory leak removed
  7631. +o    Loopback maintains IFF_LOOPBACK flag
  7632. +o    Johnathon Naylor(G4KLX) AX.25 changes
  7633. +o    Out of sync bug in lance driver fixed.
  7634. +o    First cut at ethernet loadable modules
  7635. +o    PCMICA people have ifmap stuff. Will extend this to other drivers.
  7636. +o    New de600.c
  7637. +o    Clean up of IP layer - sorted a lot of redundant and duplicated code
  7638. +    out.
  7639. +o    Removed all the old non working debugging junk from the kernel.
  7640. +o    Removed all the devices the kernel used to use as a legacy from
  7641. +    FvK's days writing the linux networking.
  7642. +o    Greg Page's latest and greatest IPX fixes (including 802.2). Now
  7643. +    I've got the stuff to write a free Netware client too and some
  7644. +    volunteers to do it.
  7645. +o    Fixed the 1.1.12 ARP fragment bug.
  7646. \ No newline at end of file
  7647. Only in linux.old/net/inet: README.orig
  7648. diff -u --new-file --recursive linux.old/net/inet/af_inet.c linux/net/inet/af_inet.c
  7649. --- linux.old/net/inet/af_inet.c    Thu Jan  1 01:00:00 1970
  7650. +++ linux/net/inet/af_inet.c    Fri May 20 18:50:47 1994
  7651. @@ -0,0 +1,1391 @@
  7652. +/*
  7653. + * INET        An implementation of the TCP/IP protocol suite for the LINUX
  7654. + *        operating system.  INET is implemented using the  BSD Socket
  7655. + *        interface as the means of communication with the user level.
  7656. + *
  7657. + *        AF_INET protocol family socket handler.
  7658. + *
  7659. + * Version:    @(#)af_inet.c    (from sock.c) 1.0.17    06/02/93
  7660. + *
  7661. + * Authors:    Ross Biro, <bir7@leland.Stanford.Edu>
  7662. + *        Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  7663. + *        Florian La Roche, <flla@stud.uni-sb.de>
  7664. + *        Alan Cox, <A.Cox@swansea.ac.uk>
  7665. + *
  7666. + *        This program is free software; you can redistribute it and/or
  7667. + *        modify it under the terms of the GNU General Public License
  7668. + *        as published by the Free Software Foundation; either version
  7669. + *        2 of the License, or (at your option) any later version.
  7670. + */
  7671. +
  7672. +#include <linux/config.h>
  7673. +#include <linux/errno.h>
  7674. +#include <linux/types.h>
  7675. +#include <linux/socket.h>
  7676. +#include <linux/in.h>
  7677. +#include <linux/kernel.h>
  7678. +#include <linux/major.h>
  7679. +#include <linux/sched.h>
  7680. +#include <linux/timer.h>
  7681. +#include <linux/string.h>
  7682. +#include <linux/sockios.h>
  7683. +#include <linux/net.h>
  7684. +#include <linux/fcntl.h>
  7685. +#include <linux/mm.h>
  7686. +#include <linux/interrupt.h>
  7687. +
  7688. +#include <asm/segment.h>
  7689. +#include <asm/system.h>
  7690. +
  7691. +#include <linux/inet.h>
  7692. +#include <linux/netdevice.h>
  7693. +#include "ip.h"
  7694. +#include "protocol.h"
  7695. +#include "arp.h"
  7696. +#include "rarp.h"
  7697. +#include "route.h"
  7698. +#include "tcp.h"
  7699. +#include "udp.h"
  7700. +#include <linux/skbuff.h>
  7701. +#include "sock.h"
  7702. +#include "raw.h"
  7703. +#include "icmp.h"
  7704. +
  7705. +#define min(a,b)    ((a)<(b)?(a):(b))
  7706. +
  7707. +extern struct proto packet_prot;
  7708. +
  7709. +
  7710. +/*
  7711. + *    See if a socket number is in use.
  7712. + */
  7713. +static int sk_inuse(struct proto *prot, int num)
  7714. +{
  7715. +    struct sock *sk;
  7716. +
  7717. +    for(sk = prot->sock_array[num & (SOCK_ARRAY_SIZE -1 )];
  7718. +        sk != NULL;  sk=sk->next) 
  7719. +    {
  7720. +        if (sk->num == num) 
  7721. +            return(1);
  7722. +    }
  7723. +    return(0);
  7724. +}
  7725. +
  7726. +
  7727. +/*
  7728. + *    Pick a new socket number
  7729. + */
  7730. +
  7731. +unsigned short get_new_socknum(struct proto *prot, unsigned short base)
  7732. +{
  7733. +    static int start=0;
  7734. +
  7735. +    /*
  7736. +     * Used to cycle through the port numbers so the
  7737. +     * chances of a confused connection drop.
  7738. +     */
  7739. +     
  7740. +    int i, j;
  7741. +    int best = 0;
  7742. +    int size = 32767; /* a big num. */
  7743. +    struct sock *sk;
  7744. +
  7745. +    if (base == 0) 
  7746. +        base = PROT_SOCK+1+(start % 1024);
  7747. +    if (base <= PROT_SOCK) 
  7748. +    {
  7749. +        base += PROT_SOCK+(start % 1024);
  7750. +    }
  7751. +
  7752. +    /* Now look through the entire array and try to find an empty ptr. */
  7753. +    for(i=0; i < SOCK_ARRAY_SIZE; i++) 
  7754. +    {
  7755. +        j = 0;
  7756. +        sk = prot->sock_array[(i+base+1) &(SOCK_ARRAY_SIZE -1)];
  7757. +        while(sk != NULL) 
  7758. +        {
  7759. +            sk = sk->next;
  7760. +            j++;
  7761. +        }
  7762. +        if (j == 0) 
  7763. +        {
  7764. +            start =(i+1+start )%1024;
  7765. +            return(i+base+1);
  7766. +        }
  7767. +        if (j < size) 
  7768. +        {
  7769. +            best = i;
  7770. +            size = j;
  7771. +        }
  7772. +    }
  7773. +
  7774. +    /* Now make sure the one we want is not in use. */
  7775. +
  7776. +    while(sk_inuse(prot, base +best+1)) 
  7777. +    {
  7778. +        best += SOCK_ARRAY_SIZE;
  7779. +    }
  7780. +    return(best+base+1);
  7781. +}
  7782. +
  7783. +/*
  7784. + *    Add a socket into the socket tables by number.
  7785. + */
  7786. +
  7787. +void put_sock(unsigned short num, struct sock *sk)
  7788. +{
  7789. +    struct sock *sk1;
  7790. +    struct sock *sk2;
  7791. +    int mask;
  7792. +
  7793. +    sk->num = num;
  7794. +    sk->next = NULL;
  7795. +    num = num &(SOCK_ARRAY_SIZE -1);
  7796. +
  7797. +    /* We can't have an interupt re-enter here. */
  7798. +    cli();
  7799. +    if (sk->prot->sock_array[num] == NULL) 
  7800. +    {
  7801. +        sk->prot->sock_array[num] = sk;
  7802. +        sti();
  7803. +        return;
  7804. +    }
  7805. +    sti();
  7806. +    for(mask = 0xff000000; mask != 0xffffffff; mask = (mask >> 8) | mask) 
  7807. +    {
  7808. +        if ((mask & sk->saddr) &&
  7809. +            (mask & sk->saddr) != (mask & 0xffffffff)) 
  7810. +        {
  7811. +            mask = mask << 8;
  7812. +            break;
  7813. +        }
  7814. +    }
  7815. +    cli();
  7816. +    sk1 = sk->prot->sock_array[num];
  7817. +    for(sk2 = sk1; sk2 != NULL; sk2=sk2->next) 
  7818. +    {
  7819. +        if (!(sk2->saddr & mask)) 
  7820. +        {
  7821. +            if (sk2 == sk1) 
  7822. +            {
  7823. +                sk->next = sk->prot->sock_array[num];
  7824. +                sk->prot->sock_array[num] = sk;
  7825. +                sti();
  7826. +                return;
  7827. +            }
  7828. +            sk->next = sk2;
  7829. +            sk1->next= sk;
  7830. +            sti();
  7831. +            return;
  7832. +        }
  7833. +        sk1 = sk2;
  7834. +    }
  7835. +
  7836. +    /* Goes at the end. */
  7837. +    sk->next = NULL;
  7838. +    sk1->next = sk;
  7839. +    sti();
  7840. +}
  7841. +
  7842. +/*
  7843. + *    Remove a socket from the socket tables.
  7844. + */
  7845. +
  7846. +static void remove_sock(struct sock *sk1)
  7847. +{
  7848. +    struct sock *sk2;
  7849. +
  7850. +    if (!sk1->prot) 
  7851. +    {
  7852. +        printk("sock.c: remove_sock: sk1->prot == NULL\n");
  7853. +        return;
  7854. +    }
  7855. +
  7856. +    /* We can't have this changing out from under us. */
  7857. +    cli();
  7858. +    sk2 = sk1->prot->sock_array[sk1->num &(SOCK_ARRAY_SIZE -1)];
  7859. +    if (sk2 == sk1) 
  7860. +    {
  7861. +        sk1->prot->sock_array[sk1->num &(SOCK_ARRAY_SIZE -1)] = sk1->next;
  7862. +        sti();
  7863. +        return;
  7864. +    }
  7865. +
  7866. +    while(sk2 && sk2->next != sk1) 
  7867. +    {
  7868. +        sk2 = sk2->next;
  7869. +    }
  7870. +
  7871. +    if (sk2) 
  7872. +    {
  7873. +        sk2->next = sk1->next;
  7874. +        sti();
  7875. +        return;
  7876. +    }
  7877. +    sti();
  7878. +}
  7879. +
  7880. +/*
  7881. + *    Destroy an AF_INET socket
  7882. + */
  7883. +void destroy_sock(struct sock *sk)
  7884. +{
  7885. +    struct sk_buff *skb;
  7886. +
  7887. +      sk->inuse = 1;            /* just to be safe. */
  7888. +
  7889. +      /* Incase it's sleeping somewhere. */
  7890. +      if (!sk->dead) 
  7891. +          sk->write_space(sk);
  7892. +
  7893. +      remove_sock(sk);
  7894. +  
  7895. +      /* Now we can no longer get new packets. */
  7896. +      delete_timer(sk);
  7897. +
  7898. +    while ((skb = tcp_dequeue_partial(sk)) != NULL) {
  7899. +        IS_SKB(skb);
  7900. +        kfree_skb(skb, FREE_WRITE);
  7901. +    }
  7902. +
  7903. +    /* Cleanup up the write buffer. */
  7904. +      while((skb = skb_dequeue(&sk->write_queue)) != NULL) {
  7905. +        IS_SKB(skb);
  7906. +        kfree_skb(skb, FREE_WRITE);
  7907. +      }
  7908. +
  7909. +      while((skb=skb_dequeue(&sk->receive_queue))!=NULL) {
  7910. +    /*
  7911. +     * This will take care of closing sockets that were
  7912. +     * listening and didn't accept everything.
  7913. +     */
  7914. +        if (skb->sk != NULL && skb->sk != sk) 
  7915. +        {
  7916. +            IS_SKB(skb);
  7917. +            skb->sk->dead = 1;
  7918. +            skb->sk->prot->close(skb->sk, 0);
  7919. +        }
  7920. +        IS_SKB(skb);
  7921. +        kfree_skb(skb, FREE_READ);
  7922. +    }
  7923. +
  7924. +    /* Now we need to clean up the send head. */
  7925. +    cli();
  7926. +    for(skb = sk->send_head; skb != NULL; )
  7927. +    {
  7928. +        struct sk_buff *skb2;
  7929. +
  7930. +        /*
  7931. +         * We need to remove skb from the transmit queue,
  7932. +         * or maybe the arp queue.
  7933. +         */
  7934. +        if (skb->next  && skb->prev) {
  7935. +/*            printk("destroy_sock: unlinked skb\n");*/
  7936. +            IS_SKB(skb);
  7937. +            skb_unlink(skb);
  7938. +        }
  7939. +        skb->dev = NULL;
  7940. +        skb2 = skb->link3;
  7941. +        kfree_skb(skb, FREE_WRITE);
  7942. +        skb = skb2;
  7943. +    }
  7944. +    sk->send_head = NULL;
  7945. +    sti();
  7946. +
  7947. +      /* And now the backlog. */
  7948. +      while((skb=skb_dequeue(&sk->back_log))!=NULL) 
  7949. +      {
  7950. +        /* this should never happen. */
  7951. +/*        printk("cleaning back_log\n");*/
  7952. +        kfree_skb(skb, FREE_READ);
  7953. +    }
  7954. +
  7955. +    /* Now if it has a half accepted/ closed socket. */
  7956. +    if (sk->pair) 
  7957. +    {
  7958. +        sk->pair->dead = 1;
  7959. +        sk->pair->prot->close(sk->pair, 0);
  7960. +        sk->pair = NULL;
  7961. +      }
  7962. +
  7963. +    /*
  7964. +     * Now if everything is gone we can free the socket
  7965. +     * structure, otherwise we need to keep it around until
  7966. +     * everything is gone.
  7967. +     */
  7968. +
  7969. +      if (sk->dead && sk->rmem_alloc == 0 && sk->wmem_alloc == 0) 
  7970. +      {
  7971. +        kfree_s((void *)sk,sizeof(*sk));
  7972. +      } 
  7973. +      else 
  7974. +      {
  7975. +        /* this should never happen. */
  7976. +        /* actually it can if an ack has just been sent. */
  7977. +        sk->destroy = 1;
  7978. +        sk->ack_backlog = 0;
  7979. +        sk->inuse = 0;
  7980. +        reset_timer(sk, TIME_DESTROY, SOCK_DESTROY_TIME);
  7981. +      }
  7982. +}
  7983. +
  7984. +/*
  7985. + *    The routines beyond this point handle the behaviour of an AF_INET
  7986. + *    socket object. Mostly it punts to the subprotocols of IP to do
  7987. + *    the work.
  7988. + */
  7989. +static int inet_fcntl(struct socket *sock, unsigned int cmd, unsigned long arg)
  7990. +{
  7991. +    struct sock *sk;
  7992. +
  7993. +    sk = (struct sock *) sock->data;
  7994. +
  7995. +    switch(cmd) 
  7996. +    {
  7997. +        case F_SETOWN:
  7998. +            /*
  7999. +             * This is a little restrictive, but it's the only
  8000. +             * way to make sure that you can't send a sigurg to
  8001. +             * another process.
  8002. +             */
  8003. +            if (!suser() && current->pgrp != -arg &&
  8004. +                current->pid != arg) return(-EPERM);
  8005. +            sk->proc = arg;
  8006. +            return(0);
  8007. +        case F_GETOWN:
  8008. +            return(sk->proc);
  8009. +        default:
  8010. +            return(-EINVAL);
  8011. +    }
  8012. +}
  8013. +
  8014. +/*
  8015. + *    Set socket options on an inet socket.
  8016. + */
  8017. +static int inet_setsockopt(struct socket *sock, int level, int optname,
  8018. +            char *optval, int optlen)
  8019. +{
  8020. +      struct sock *sk = (struct sock *) sock->data;  
  8021. +    if (level == SOL_SOCKET)
  8022. +        return sock_setsockopt(sk,level,optname,optval,optlen);
  8023. +    if (sk->prot->setsockopt==NULL)
  8024. +        return(-EOPNOTSUPP);
  8025. +    else
  8026. +        return sk->prot->setsockopt(sk,level,optname,optval,optlen);
  8027. +}
  8028. +
  8029. +
  8030. +
  8031. +static int inet_getsockopt(struct socket *sock, int level, int optname,
  8032. +            char *optval, int *optlen)
  8033. +{
  8034. +      struct sock *sk = (struct sock *) sock->data;      
  8035. +      if (level == SOL_SOCKET) 
  8036. +          return sock_getsockopt(sk,level,optname,optval,optlen);
  8037. +      if(sk->prot->getsockopt==NULL)      
  8038. +          return(-EOPNOTSUPP);
  8039. +      else
  8040. +          return sk->prot->getsockopt(sk,level,optname,optval,optlen);
  8041. +}
  8042. +
  8043. +
  8044. +static int inet_autobind(struct sock *sk)
  8045. +{
  8046. +    /* We may need to bind the socket. */
  8047. +    if (sk->num == 0) 
  8048. +    {
  8049. +        sk->num = get_new_socknum(sk->prot, 0);
  8050. +        if (sk->num == 0) 
  8051. +            return(-EAGAIN);
  8052. +        put_sock(sk->num, sk);
  8053. +        sk->dummy_th.source = ntohs(sk->num);
  8054. +    }
  8055. +    return 0;
  8056. +}
  8057. +
  8058. +static int inet_listen(struct socket *sock, int backlog)
  8059. +{
  8060. +    struct sock *sk = (struct sock *) sock->data;
  8061. +
  8062. +    if(inet_autobind(sk)!=0)
  8063. +        return -EAGAIN;
  8064. +
  8065. +    /* We might as well re use these. */ 
  8066. +    sk->max_ack_backlog = backlog;
  8067. +    if (sk->state != TCP_LISTEN) 
  8068. +    {
  8069. +        sk->ack_backlog = 0;
  8070. +        sk->state = TCP_LISTEN;
  8071. +    }
  8072. +    return(0);
  8073. +}
  8074. +
  8075. +/*
  8076. + *    Default callbacks for user INET sockets. These just wake up
  8077. + *    the user owning the socket.
  8078. + */
  8079. +
  8080. +static void def_callback1(struct sock *sk)
  8081. +{
  8082. +    if(!sk->dead)
  8083. +        wake_up_interruptible(sk->sleep);
  8084. +}
  8085. +
  8086. +static void def_callback2(struct sock *sk,int len)
  8087. +{
  8088. +    if(!sk->dead)
  8089. +        wake_up_interruptible(sk->sleep);
  8090. +}
  8091. +
  8092. +
  8093. +/*
  8094. + *    Create an inet socket.
  8095. + *
  8096. + *    FIXME: Gcc would generate much better code if we set the parameters
  8097. + *    up in in-memory structure order. Gcc68K even more so
  8098. + */
  8099. +
  8100. +static int inet_create(struct socket *sock, int protocol)
  8101. +{
  8102. +    struct sock *sk;
  8103. +    struct proto *prot;
  8104. +    int err;
  8105. +
  8106. +    sk = (struct sock *) kmalloc(sizeof(*sk), GFP_KERNEL);
  8107. +    if (sk == NULL) 
  8108. +        return(-ENOBUFS);
  8109. +    sk->num = 0;
  8110. +    sk->reuse = 0;
  8111. +    switch(sock->type) 
  8112. +    {
  8113. +        case SOCK_STREAM:
  8114. +        case SOCK_SEQPACKET:
  8115. +            if (protocol && protocol != IPPROTO_TCP) 
  8116. +            {
  8117. +                kfree_s((void *)sk, sizeof(*sk));
  8118. +                return(-EPROTONOSUPPORT);
  8119. +            }
  8120. +            protocol = IPPROTO_TCP;
  8121. +            sk->no_check = TCP_NO_CHECK;
  8122. +            prot = &tcp_prot;
  8123. +            break;
  8124. +
  8125. +        case SOCK_DGRAM:
  8126. +            if (protocol && protocol != IPPROTO_UDP) 
  8127. +            {
  8128. +                kfree_s((void *)sk, sizeof(*sk));
  8129. +                return(-EPROTONOSUPPORT);
  8130. +            }
  8131. +            protocol = IPPROTO_UDP;
  8132. +            sk->no_check = UDP_NO_CHECK;
  8133. +            prot=&udp_prot;
  8134. +            break;
  8135. +      
  8136. +        case SOCK_RAW:
  8137. +            if (!suser()) 
  8138. +            {
  8139. +                kfree_s((void *)sk, sizeof(*sk));
  8140. +                return(-EPERM);
  8141. +            }
  8142. +            if (!protocol) 
  8143. +            {
  8144. +                kfree_s((void *)sk, sizeof(*sk));
  8145. +                return(-EPROTONOSUPPORT);
  8146. +            }
  8147. +            prot = &raw_prot;
  8148. +            sk->reuse = 1;
  8149. +            sk->no_check = 0;    /*
  8150. +                         * Doesn't matter no checksum is
  8151. +                         * preformed anyway.
  8152. +                         */
  8153. +            sk->num = protocol;
  8154. +            break;
  8155. +
  8156. +        case SOCK_PACKET:
  8157. +            if (!suser()) 
  8158. +            {
  8159. +                kfree_s((void *)sk, sizeof(*sk));
  8160. +                return(-EPERM);
  8161. +            }
  8162. +            if (!protocol) 
  8163. +            {
  8164. +                kfree_s((void *)sk, sizeof(*sk));
  8165. +                return(-EPROTONOSUPPORT);
  8166. +            }
  8167. +            prot = &packet_prot;
  8168. +            sk->reuse = 1;
  8169. +            sk->no_check = 0;    /* Doesn't matter no checksum is
  8170. +                         * preformed anyway.
  8171. +                         */
  8172. +            sk->num = protocol;
  8173. +            break;
  8174. +
  8175. +        default:
  8176. +            kfree_s((void *)sk, sizeof(*sk));
  8177. +            return(-ESOCKTNOSUPPORT);
  8178. +    }
  8179. +    sk->socket = sock;
  8180. +#ifdef CONFIG_TCP_NAGLE_OFF
  8181. +    sk->nonagle = 1;
  8182. +#else    
  8183. +    sk->nonagle = 0;
  8184. +#endif  
  8185. +    sk->type = sock->type;
  8186. +    sk->stamp.tv_sec=0;
  8187. +    sk->protocol = protocol;
  8188. +    sk->wmem_alloc = 0;
  8189. +    sk->rmem_alloc = 0;
  8190. +    sk->sndbuf = SK_WMEM_MAX;
  8191. +    sk->rcvbuf = SK_RMEM_MAX;
  8192. +    sk->pair = NULL;
  8193. +    sk->opt = NULL;
  8194. +    sk->write_seq = 0;
  8195. +    sk->acked_seq = 0;
  8196. +    sk->copied_seq = 0;
  8197. +    sk->fin_seq = 0;
  8198. +    sk->urg_seq = 0;
  8199. +    sk->urg_data = 0;
  8200. +    sk->proc = 0;
  8201. +    sk->rtt = 0;                /*TCP_WRITE_TIME << 3;*/
  8202. +    sk->rto = TCP_TIMEOUT_INIT;        /*TCP_WRITE_TIME*/
  8203. +    sk->mdev = 0;
  8204. +    sk->backoff = 0;
  8205. +    sk->packets_out = 0;
  8206. +    sk->cong_window = 1; /* start with only sending one packet at a time. */
  8207. +    sk->cong_count = 0;
  8208. +    sk->ssthresh = 0;
  8209. +    sk->max_window = 0;
  8210. +    sk->urginline = 0;
  8211. +    sk->intr = 0;
  8212. +    sk->linger = 0;
  8213. +    sk->destroy = 0;
  8214. +    sk->priority = 1;
  8215. +    sk->shutdown = 0;
  8216. +    sk->keepopen = 0;
  8217. +    sk->zapped = 0;
  8218. +    sk->done = 0;
  8219. +    sk->ack_backlog = 0;
  8220. +    sk->window = 0;
  8221. +    sk->bytes_rcv = 0;
  8222. +    sk->state = TCP_CLOSE;
  8223. +    sk->dead = 0;
  8224. +    sk->ack_timed = 0;
  8225. +    sk->partial = NULL;
  8226. +    sk->user_mss = 0;
  8227. +    sk->debug = 0;
  8228. +
  8229. +    /* this is how many unacked bytes we will accept for this socket.  */
  8230. +    sk->max_unacked = 2048; /* needs to be at most 2 full packets. */
  8231. +
  8232. +    /* how many packets we should send before forcing an ack. 
  8233. +       if this is set to zero it is the same as sk->delay_acks = 0 */
  8234. +    sk->max_ack_backlog = 0;
  8235. +    sk->inuse = 0;
  8236. +    sk->delay_acks = 0;
  8237. +    skb_queue_head_init(&sk->write_queue);
  8238. +    skb_queue_head_init(&sk->receive_queue);
  8239. +    sk->mtu = 576;
  8240. +    sk->prot = prot;
  8241. +    sk->sleep = sock->wait;
  8242. +    sk->daddr = 0;
  8243. +    sk->saddr = ip_my_addr();
  8244. +    sk->err = 0;
  8245. +    sk->next = NULL;
  8246. +    sk->pair = NULL;
  8247. +    sk->send_tail = NULL;
  8248. +    sk->send_head = NULL;
  8249. +    sk->timeout = 0;
  8250. +    sk->broadcast = 0;
  8251. +    sk->localroute = 0;
  8252. +    sk->timer.data = (unsigned long)sk;
  8253. +    sk->timer.function = &net_timer;
  8254. +    skb_queue_head_init(&sk->back_log);
  8255. +    sk->blog = 0;
  8256. +    sock->data =(void *) sk;
  8257. +    sk->dummy_th.doff = sizeof(sk->dummy_th)/4;
  8258. +    sk->dummy_th.res1=0;
  8259. +    sk->dummy_th.res2=0;
  8260. +    sk->dummy_th.urg_ptr = 0;
  8261. +    sk->dummy_th.fin = 0;
  8262. +    sk->dummy_th.syn = 0;
  8263. +    sk->dummy_th.rst = 0;
  8264. +    sk->dummy_th.psh = 0;
  8265. +    sk->dummy_th.ack = 0;
  8266. +    sk->dummy_th.urg = 0;
  8267. +    sk->dummy_th.dest = 0;
  8268. +    sk->ip_tos=0;
  8269. +    sk->ip_ttl=64;
  8270. +      
  8271. +    sk->state_change = def_callback1;
  8272. +    sk->data_ready = def_callback2;
  8273. +    sk->write_space = def_callback1;
  8274. +    sk->error_report = def_callback1;
  8275. +
  8276. +    if (sk->num) 
  8277. +    {
  8278. +    /*
  8279. +     * It assumes that any protocol which allows
  8280. +     * the user to assign a number at socket
  8281. +     * creation time automatically
  8282. +     * shares.
  8283. +     */
  8284. +        put_sock(sk->num, sk);
  8285. +        sk->dummy_th.source = ntohs(sk->num);
  8286. +    }
  8287. +
  8288. +    if (sk->prot->init) 
  8289. +    {
  8290. +        err = sk->prot->init(sk);
  8291. +        if (err != 0) 
  8292. +        {
  8293. +            destroy_sock(sk);
  8294. +            return(err);
  8295. +        }
  8296. +    }
  8297. +    return(0);
  8298. +}
  8299. +
  8300. +
  8301. +/*
  8302. + *    Duplicate a socket.
  8303. + */
  8304. +static int inet_dup(struct socket *newsock, struct socket *oldsock)
  8305. +{
  8306. +    return(inet_create(newsock,((struct sock *)(oldsock->data))->protocol));
  8307. +}
  8308. +
  8309. +
  8310. +/*
  8311. + *    The peer socket should always be NULL (or else). When we call this
  8312. + *    function we are destroying the object and from then on nobody
  8313. + *    should refer to it.
  8314. + */
  8315. +static int inet_release(struct socket *sock, struct socket *peer)
  8316. +{
  8317. +    struct sock *sk = (struct sock *) sock->data;
  8318. +    if (sk == NULL) 
  8319. +        return(0);
  8320. +
  8321. +    sk->state_change(sk);
  8322. +
  8323. +    /* Start closing the connection.  This may take a while. */
  8324. +
  8325. +    /*
  8326. +     * If linger is set, we don't return until the close
  8327. +     * is complete.  Other wise we return immediately. The
  8328. +     * actually closing is done the same either way.
  8329. +     */
  8330. +
  8331. +    if (sk->linger == 0) 
  8332. +    {
  8333. +        sk->prot->close(sk,0);
  8334. +        sk->dead = 1;
  8335. +    } 
  8336. +    else 
  8337. +    {
  8338. +        sk->prot->close(sk, 0);
  8339. +        cli();
  8340. +        if (sk->lingertime)
  8341. +            current->timeout = jiffies + HZ*sk->lingertime;
  8342. +        while(sk->state != TCP_CLOSE && current->timeout>0) 
  8343. +        {
  8344. +            interruptible_sleep_on(sk->sleep);
  8345. +            if (current->signal & ~current->blocked) 
  8346. +            {
  8347. +                break;
  8348. +#if 0
  8349. +                /* not working now - closes can't be restarted */
  8350. +                sti();
  8351. +                current->timeout=0;
  8352. +                return(-ERESTARTSYS);
  8353. +#endif
  8354. +            }
  8355. +        }
  8356. +        current->timeout=0;
  8357. +        sti();
  8358. +        sk->dead = 1;
  8359. +    }
  8360. +    sk->inuse = 1;
  8361. +
  8362. +    /* This will destroy it. */
  8363. +    release_sock(sk);
  8364. +    sock->data = NULL;
  8365. +    return(0);
  8366. +}
  8367. +
  8368. +
  8369. +/* this needs to be changed to dissallow
  8370. +   the rebinding of sockets.   What error
  8371. +   should it return? */
  8372. +
  8373. +static int inet_bind(struct socket *sock, struct sockaddr *uaddr,
  8374. +           int addr_len)
  8375. +{
  8376. +    struct sockaddr_in addr;
  8377. +    struct sock *sk=(struct sock *)sock->data, *sk2;
  8378. +    unsigned short snum;
  8379. +    int err;
  8380. +    int chk_addr_ret;
  8381. +
  8382. +    /* check this error. */
  8383. +    if (sk->state != TCP_CLOSE)
  8384. +        return(-EIO);
  8385. +    if (sk->num != 0) 
  8386. +        return(-EINVAL);
  8387. +
  8388. +    err=verify_area(VERIFY_READ, uaddr, addr_len);
  8389. +    if(err)
  8390. +          return err;
  8391. +    memcpy_fromfs(&addr, uaddr, min(sizeof(addr), addr_len));
  8392. +
  8393. +    snum = ntohs(addr.sin_port);
  8394. +
  8395. +    /*
  8396. +     * We can't just leave the socket bound wherever it is, it might
  8397. +     * be bound to a privileged port. However, since there seems to
  8398. +     * be a bug here, we will leave it if the port is not privileged.
  8399. +     */
  8400. +    if (snum == 0) 
  8401. +    {
  8402. +        snum = get_new_socknum(sk->prot, 0);
  8403. +    }
  8404. +    if (snum < PROT_SOCK && !suser()) 
  8405. +        return(-EACCES);
  8406. +
  8407. +    chk_addr_ret = ip_chk_addr(addr.sin_addr.s_addr);
  8408. +    if (addr.sin_addr.s_addr != 0 && chk_addr_ret != IS_MYADDR)
  8409. +        return(-EADDRNOTAVAIL);    /* Source address MUST be ours! */
  8410. +      
  8411. +    if (chk_addr_ret || addr.sin_addr.s_addr == 0)
  8412. +        sk->saddr = addr.sin_addr.s_addr;
  8413. +
  8414. +    /* Make sure we are allowed to bind here. */
  8415. +    cli();
  8416. +outside_loop:
  8417. +    for(sk2 = sk->prot->sock_array[snum & (SOCK_ARRAY_SIZE -1)];
  8418. +                    sk2 != NULL; sk2 = sk2->next) 
  8419. +    {
  8420. +/* should be below! */
  8421. +        if (sk2->num != snum) continue;
  8422. +        if (sk2->dead) 
  8423. +        {
  8424. +            destroy_sock(sk2);
  8425. +            goto outside_loop;
  8426. +        }
  8427. +        if (!sk->reuse) 
  8428. +        {
  8429. +            sti();
  8430. +            return(-EADDRINUSE);
  8431. +        }
  8432. +        
  8433. +        if (sk2->num != snum) 
  8434. +            continue;        /* more than one */
  8435. +        if (sk2->saddr != sk->saddr) 
  8436. +            continue;    /* socket per slot ! -FB */
  8437. +        if (!sk2->reuse) 
  8438. +        {
  8439. +            sti();
  8440. +            return(-EADDRINUSE);
  8441. +        }
  8442. +    }
  8443. +    sti();
  8444. +
  8445. +    remove_sock(sk);
  8446. +    put_sock(snum, sk);
  8447. +    sk->dummy_th.source = ntohs(sk->num);
  8448. +    sk->daddr = 0;
  8449. +    sk->dummy_th.dest = 0;
  8450. +    return(0);
  8451. +}
  8452. +
  8453. +/*
  8454. + *    Handle sk->err properly. The cli/sti matter.
  8455. + */
  8456. +static int inet_error(struct sock *sk)
  8457. +{
  8458. +    unsigned long flags;
  8459. +    int err;
  8460. +    save_flags(flags);
  8461. +    cli();    
  8462. +    err=sk->err;
  8463. +    sk->err=0;
  8464. +    sti();
  8465. +    return -err;
  8466. +}
  8467. +
  8468. +/*
  8469. + *    Connect to a remote host. There is regretably still a little
  8470. + *    TCP 'magic' in here.
  8471. + */
  8472. +static int inet_connect(struct socket *sock, struct sockaddr * uaddr,
  8473. +          int addr_len, int flags)
  8474. +{
  8475. +    struct sock *sk=(struct sock *)sock->data;
  8476. +    int err;
  8477. +    sock->conn = NULL;
  8478. +
  8479. +    if (sock->state == SS_CONNECTING && sk->state == TCP_ESTABLISHED)
  8480. +    {
  8481. +        sock->state = SS_CONNECTED;
  8482. +        /* Connection completing after a connect/EINPROGRESS/select/connect */
  8483. +        return 0;    /* Rock and roll */
  8484. +    }
  8485. +
  8486. +    if (sock->state == SS_CONNECTING && sk->protocol == IPPROTO_TCP && (flags & O_NONBLOCK))
  8487. +        return -EALREADY;    /* Connecting is currently in progress */
  8488. +      
  8489. +    if (sock->state != SS_CONNECTING) 
  8490. +    {
  8491. +        /* We may need to bind the socket. */
  8492. +        if(inet_autobind(sk)!=0)
  8493. +            return(-EAGAIN);
  8494. +        if (sk->prot->connect == NULL) 
  8495. +            return(-EOPNOTSUPP);
  8496. +        err = sk->prot->connect(sk, (struct sockaddr_in *)uaddr, addr_len);
  8497. +        if (err < 0) 
  8498. +            return(err);
  8499. +          sock->state = SS_CONNECTING;
  8500. +    }
  8501. +
  8502. +    if (sk->state != TCP_ESTABLISHED &&(flags & O_NONBLOCK)) 
  8503. +          return(-EINPROGRESS);
  8504. +
  8505. +    cli(); /* avoid the race condition */
  8506. +    while(sk->state == TCP_SYN_SENT || sk->state == TCP_SYN_RECV) 
  8507. +    {
  8508. +        interruptible_sleep_on(sk->sleep);
  8509. +        if (current->signal & ~current->blocked) 
  8510. +        {
  8511. +            sti();
  8512. +            return(-ERESTARTSYS);
  8513. +        }
  8514. +        /* This fixes a nasty in the tcp/ip code. There is a hideous hassle with
  8515. +           icmp error packets wanting to close a tcp or udp socket. */
  8516. +        if(sk->err && sk->protocol == IPPROTO_TCP)
  8517. +        {
  8518. +            sti();
  8519. +            sock->state = SS_UNCONNECTED;
  8520. +            err = -sk->err;
  8521. +            sk->err=0;
  8522. +            return err; /* set by tcp_err() */
  8523. +        }
  8524. +    }
  8525. +    sti();
  8526. +    sock->state = SS_CONNECTED;
  8527. +
  8528. +    if (sk->state != TCP_ESTABLISHED && sk->err) 
  8529. +    {
  8530. +        sock->state = SS_UNCONNECTED;
  8531. +        err=sk->err;
  8532. +        sk->err=0;
  8533. +        return(-err);
  8534. +    }
  8535. +    return(0);
  8536. +}
  8537. +
  8538. +
  8539. +static int inet_socketpair(struct socket *sock1, struct socket *sock2)
  8540. +{
  8541. +     return(-EOPNOTSUPP);
  8542. +}
  8543. +
  8544. +
  8545. +/*
  8546. + *    FIXME: Get BSD behaviour
  8547. + */
  8548. +
  8549. +static int inet_accept(struct socket *sock, struct socket *newsock, int flags)
  8550. +{
  8551. +    struct sock *sk1, *sk2;
  8552. +    int err;
  8553. +
  8554. +    sk1 = (struct sock *) sock->data;
  8555. +
  8556. +    /*
  8557. +     * We've been passed an extra socket.
  8558. +     * We need to free it up because the tcp module creates
  8559. +     * it's own when it accepts one.
  8560. +     */
  8561. +    if (newsock->data)
  8562. +    {
  8563. +          struct sock *sk=(struct sock *)newsock->data;
  8564. +          newsock->data=NULL;
  8565. +          sk->dead = 1;
  8566. +          destroy_sock(sk);
  8567. +    }
  8568. +  
  8569. +    if (sk1->prot->accept == NULL) 
  8570. +        return(-EOPNOTSUPP);
  8571. +
  8572. +    /* Restore the state if we have been interrupted, and then returned. */
  8573. +    if (sk1->pair != NULL ) 
  8574. +    {
  8575. +        sk2 = sk1->pair;
  8576. +        sk1->pair = NULL;
  8577. +    } 
  8578. +    else
  8579. +    {
  8580. +        sk2 = sk1->prot->accept(sk1,flags);
  8581. +        if (sk2 == NULL) 
  8582. +        {
  8583. +            if (sk1->err <= 0)
  8584. +                printk("Warning sock.c:sk1->err <= 0.  Returning non-error.\n");
  8585. +            err=sk1->err;
  8586. +            sk1->err=0;
  8587. +            return(-err);
  8588. +        }
  8589. +    }
  8590. +    newsock->data = (void *)sk2;
  8591. +    sk2->sleep = newsock->wait;
  8592. +    newsock->conn = NULL;
  8593. +    if (flags & O_NONBLOCK) 
  8594. +        return(0);
  8595. +
  8596. +    cli(); /* avoid the race. */
  8597. +    while(sk2->state == TCP_SYN_RECV) 
  8598. +    {
  8599. +        interruptible_sleep_on(sk2->sleep);
  8600. +        if (current->signal & ~current->blocked) 
  8601. +        {
  8602. +            sti();
  8603. +            sk1->pair = sk2;
  8604. +            sk2->sleep = NULL;
  8605. +            newsock->data = NULL;
  8606. +            return(-ERESTARTSYS);
  8607. +        }
  8608. +    }
  8609. +    sti();
  8610. +
  8611. +    if (sk2->state != TCP_ESTABLISHED && sk2->err > 0) 
  8612. +    {
  8613. +        err = -sk2->err;
  8614. +        sk2->err=0;
  8615. +        destroy_sock(sk2);
  8616. +        newsock->data = NULL;
  8617. +        return(err);
  8618. +    }
  8619. +    newsock->state = SS_CONNECTED;
  8620. +    return(0);
  8621. +}
  8622. +
  8623. +
  8624. +/*
  8625. + *    This does both peername and sockname.
  8626. + */
  8627. +static int inet_getname(struct socket *sock, struct sockaddr *uaddr,
  8628. +         int *uaddr_len, int peer)
  8629. +{
  8630. +    struct sockaddr_in sin;
  8631. +    struct sock *sk;
  8632. +    int len;
  8633. +    int err;
  8634. +  
  8635. +  
  8636. +    err = verify_area(VERIFY_WRITE,uaddr_len,sizeof(long));
  8637. +    if(err)
  8638. +        return err;
  8639. +      
  8640. +    len=get_fs_long(uaddr_len);
  8641. +  
  8642. +    err = verify_area(VERIFY_WRITE, uaddr, len);
  8643. +    if(err)
  8644. +        return err;
  8645. +      
  8646. +    /* Check this error. */
  8647. +    if (len < sizeof(sin)) 
  8648. +        return(-EINVAL);
  8649. +
  8650. +    sin.sin_family = AF_INET;
  8651. +    sk = (struct sock *) sock->data;
  8652. +    if (peer) 
  8653. +    {
  8654. +        if (!tcp_connected(sk->state)) 
  8655. +            return(-ENOTCONN);
  8656. +        sin.sin_port = sk->dummy_th.dest;
  8657. +        sin.sin_addr.s_addr = sk->daddr;
  8658. +    } 
  8659. +    else 
  8660. +    {
  8661. +        sin.sin_port = sk->dummy_th.source;
  8662. +        if (sk->saddr == 0) 
  8663. +            sin.sin_addr.s_addr = ip_my_addr();
  8664. +        else 
  8665. +            sin.sin_addr.s_addr = sk->saddr;
  8666. +    }
  8667. +    len = sizeof(sin);
  8668. +    memcpy_tofs(uaddr, &sin, sizeof(sin));
  8669. +    put_fs_long(len, uaddr_len);
  8670. +    return(0);
  8671. +}
  8672. +
  8673. +
  8674. +/*
  8675. + *    The assorted BSD I/O operations
  8676. + */
  8677. +
  8678. +
  8679. +static int inet_recv(struct socket *sock, void *ubuf, int size, int noblock,
  8680. +      unsigned flags)
  8681. +{
  8682. +    struct sock *sk = (struct sock *) sock->data;
  8683. +    int err;
  8684. +    
  8685. +    if(sk->err)
  8686. +        return inet_error(sk);
  8687. +    if(size<0)
  8688. +        return -EINVAL;
  8689. +    if(size==0)
  8690. +        return 0;
  8691. +    err=verify_area(VERIFY_WRITE,ubuf,size);
  8692. +    if(err)
  8693. +        return err;
  8694. +
  8695. +    /* We may need to bind the socket. */
  8696. +    if(inet_autobind(sk))
  8697. +        return(-EAGAIN);    
  8698. +    return(sk->prot->read(sk, (unsigned char *) ubuf, size, noblock, flags));
  8699. +}
  8700. +
  8701. +
  8702. +static int inet_read(struct socket *sock, char *ubuf, int size, int noblock)
  8703. +{
  8704. +    return inet_recv(sock,ubuf,size,noblock,0);
  8705. +}
  8706. +
  8707. +static int inet_send(struct socket *sock, void *ubuf, int size, int noblock, 
  8708. +           unsigned flags)
  8709. +{
  8710. +    struct sock *sk = (struct sock *) sock->data;
  8711. +    int err;
  8712. +    if (sk->shutdown & SEND_SHUTDOWN) 
  8713. +    {
  8714. +        send_sig(SIGPIPE, current, 1);
  8715. +        return(-EPIPE);
  8716. +    }
  8717. +    if(sk->err)
  8718. +        return inet_error(sk);
  8719. +    if(size<0)
  8720. +        return -EINVAL;
  8721. +    if(size==0)
  8722. +        return 0;
  8723. +    err=verify_area(VERIFY_READ,ubuf,size);
  8724. +    if(err)
  8725. +        return err;
  8726. +    /* We may need to bind the socket. */
  8727. +    if(inet_autobind(sk)!=0)
  8728. +        return(-EAGAIN);
  8729. +    return(sk->prot->write(sk, (unsigned char *) ubuf, size, noblock, flags));
  8730. +}
  8731. +
  8732. +static int inet_write(struct socket *sock, char *ubuf, int size, int noblock)
  8733. +{
  8734. +    return inet_send(sock,ubuf,size,noblock,0);
  8735. +}
  8736. +
  8737. +static int inet_sendto(struct socket *sock, void *ubuf, int size, int noblock, 
  8738. +        unsigned flags, struct sockaddr *sin, int addr_len)
  8739. +{
  8740. +    int err;
  8741. +    struct sock *sk = (struct sock *) sock->data;
  8742. +    if (sk->shutdown & SEND_SHUTDOWN) 
  8743. +    {
  8744. +        send_sig(SIGPIPE, current, 1);
  8745. +        return(-EPIPE);
  8746. +    }
  8747. +    if (sk->prot->sendto == NULL) 
  8748. +        return(-EOPNOTSUPP);
  8749. +    if(sk->err)
  8750. +        return inet_error(sk);
  8751. +    if(size<0)
  8752. +        return -EINVAL;
  8753. +    if(size==0)
  8754. +        return 0;
  8755. +    err=verify_area(VERIFY_READ,ubuf,size);
  8756. +    if(err)
  8757. +        return err;
  8758. +
  8759. +    /* We may need to bind the socket. */
  8760. +    
  8761. +    if(inet_autobind(sk)!=0)
  8762. +        return -EAGAIN;
  8763. +    return(sk->prot->sendto(sk, (unsigned char *) ubuf, size, noblock, flags, 
  8764. +               (struct sockaddr_in *)sin, addr_len));
  8765. +}
  8766. +
  8767. +
  8768. +static int inet_recvfrom(struct socket *sock, void *ubuf, int size, int noblock, 
  8769. +           unsigned flags, struct sockaddr *sin, int *addr_len )
  8770. +{
  8771. +    struct sock *sk = (struct sock *) sock->data;
  8772. +    int err;
  8773. +    
  8774. +    if (sk->prot->recvfrom == NULL) 
  8775. +        return(-EOPNOTSUPP);
  8776. +    if(sk->err)
  8777. +        return inet_error(sk);
  8778. +    if(size<0)
  8779. +        return -EINVAL;
  8780. +    if(size==0)
  8781. +        return 0;
  8782. +    err=verify_area(VERIFY_READ,ubuf,size);
  8783. +    if(err)
  8784. +        return err;
  8785. +
  8786. +    /* We may need to bind the socket. */
  8787. +    if(inet_autobind(sk)!=0)
  8788. +        return(-EAGAIN);
  8789. +    return(sk->prot->recvfrom(sk, (unsigned char *) ubuf, size, noblock, flags,
  8790. +                 (struct sockaddr_in*)sin, addr_len));
  8791. +}
  8792. +
  8793. +
  8794. +static int inet_shutdown(struct socket *sock, int how)
  8795. +{
  8796. +    struct sock *sk=(struct sock*)sock->data;
  8797. +
  8798. +    /*
  8799. +     * This should really check to make sure
  8800. +     * the socket is a TCP socket. (WHY AC...)
  8801. +     */
  8802. +    how++; /* maps 0->1 has the advantage of making bit 1 rcvs and
  8803. +               1->2 bit 2 snds.
  8804. +               2->3 */
  8805. +    if ((how & ~SHUTDOWN_MASK) || how==0)    /* MAXINT->0 */
  8806. +        return(-EINVAL);
  8807. +    if (sock->state == SS_CONNECTING && sk->state == TCP_ESTABLISHED)
  8808. +        sock->state = SS_CONNECTED;
  8809. +    if (!tcp_connected(sk->state)) 
  8810. +        return(-ENOTCONN);
  8811. +    sk->shutdown |= how;
  8812. +    if (sk->prot->shutdown)
  8813. +        sk->prot->shutdown(sk, how);
  8814. +    return(0);
  8815. +}
  8816. +
  8817. +
  8818. +static int inet_select(struct socket *sock, int sel_type, select_table *wait )
  8819. +{
  8820. +    struct sock *sk=(struct sock *) sock->data;
  8821. +    if (sk->prot->select == NULL) 
  8822. +    {
  8823. +        return(0);
  8824. +    }
  8825. +    return(sk->prot->select(sk, sel_type, wait));
  8826. +}
  8827. +
  8828. +/*
  8829. + *    ioctl() calls you can issue on an INET socket. Most of these are
  8830. + *    device configuration and stuff and very rarely used. Some ioctls
  8831. + *    pass on to the socket itself.
  8832. + *
  8833. + *    NOTE: I like the idea of a module for the config stuff. ie ifconfig
  8834. + *    loads the devconfigure module does its configuring and unloads it.
  8835. + *    Theres a good 20K of config code hanging around the kernel.
  8836. + */
  8837. +
  8838. +static int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
  8839. +{
  8840. +    struct sock *sk=(struct sock *)sock->data;
  8841. +    int err;
  8842. +
  8843. +    switch(cmd) 
  8844. +    {
  8845. +        case FIOSETOWN:
  8846. +        case SIOCSPGRP:
  8847. +            err=verify_area(VERIFY_READ,(int *)arg,sizeof(long));
  8848. +            if(err)
  8849. +                return err;
  8850. +            sk->proc = get_fs_long((int *) arg);
  8851. +            return(0);
  8852. +        case FIOGETOWN:
  8853. +        case SIOCGPGRP:
  8854. +            err=verify_area(VERIFY_WRITE,(void *) arg, sizeof(long));
  8855. +            if(err)
  8856. +                return err;
  8857. +            put_fs_long(sk->proc,(int *)arg);
  8858. +            return(0);            
  8859. +        case SIOCGSTAMP:
  8860. +            if(sk->stamp.tv_sec==0)
  8861. +                return -ENOENT;
  8862. +            err=verify_area(VERIFY_WRITE,(void *)arg,sizeof(struct timeval));
  8863. +            if(err)
  8864. +                return err;
  8865. +            memcpy_tofs((void *)arg,&sk->stamp,sizeof(struct timeval));
  8866. +            return 0;
  8867. +        case SIOCADDRT: case SIOCADDRTOLD:
  8868. +        case SIOCDELRT: case SIOCDELRTOLD:
  8869. +            return(ip_rt_ioctl(cmd,(void *) arg));
  8870. +        case SIOCDARP:
  8871. +        case SIOCGARP:
  8872. +        case SIOCSARP:
  8873. +            return(arp_ioctl(cmd,(void *) arg));
  8874. +#ifdef CONFIG_INET_RARP            
  8875. +        case SIOCDRARP:
  8876. +        case SIOCGRARP:
  8877. +        case SIOCSRARP:
  8878. +            return(rarp_ioctl(cmd,(void *) arg));
  8879. +#endif
  8880. +        case SIOCGIFCONF:
  8881. +        case SIOCGIFFLAGS:
  8882. +        case SIOCSIFFLAGS:
  8883. +        case SIOCGIFADDR:
  8884. +        case SIOCSIFADDR:
  8885. +        case SIOCGIFDSTADDR:
  8886. +        case SIOCSIFDSTADDR:
  8887. +        case SIOCGIFBRDADDR:
  8888. +        case SIOCSIFBRDADDR:
  8889. +        case SIOCGIFNETMASK:
  8890. +        case SIOCSIFNETMASK:
  8891. +        case SIOCGIFMETRIC:
  8892. +        case SIOCSIFMETRIC:
  8893. +        case SIOCGIFMEM:
  8894. +        case SIOCSIFMEM:
  8895. +        case SIOCGIFMTU:
  8896. +        case SIOCSIFMTU:
  8897. +        case SIOCSIFLINK:
  8898. +        case SIOCGIFHWADDR:
  8899. +        case SIOCSIFHWADDR:
  8900. +        case OLD_SIOCGIFHWADDR:
  8901. +        case SIOCSIFMAP:
  8902. +        case SIOCGIFMAP:
  8903. +        case SIOCDEVPRIVATE:
  8904. +            return(dev_ioctl(cmd,(void *) arg));
  8905. +
  8906. +        default:
  8907. +            if (sk->prot->ioctl==NULL) 
  8908. +                return(-EINVAL);
  8909. +            return(sk->prot->ioctl(sk, cmd, arg));
  8910. +    }
  8911. +    /*NOTREACHED*/
  8912. +    return(0);
  8913. +}
  8914. +
  8915. +/*
  8916. + * This routine must find a socket given a TCP or UDP header.
  8917. + * Everyhting is assumed to be in net order.
  8918. + */
  8919. +
  8920. +struct sock *get_sock(struct proto *prot, unsigned short num,
  8921. +                unsigned long raddr,
  8922. +                unsigned short rnum, unsigned long laddr)
  8923. +{
  8924. +    struct sock *s;
  8925. +    unsigned short hnum;
  8926. +
  8927. +    hnum = ntohs(num);
  8928. +
  8929. +    /*
  8930. +     * SOCK_ARRAY_SIZE must be a power of two.  This will work better
  8931. +     * than a prime unless 3 or more sockets end up using the same
  8932. +     * array entry.  This should not be a problem because most
  8933. +     * well known sockets don't overlap that much, and for
  8934. +     * the other ones, we can just be careful about picking our
  8935. +     * socket number when we choose an arbitrary one.
  8936. +     */
  8937. +
  8938. +    for(s = prot->sock_array[hnum & (SOCK_ARRAY_SIZE - 1)];
  8939. +            s != NULL; s = s->next) 
  8940. +    {
  8941. +        if (s->num != hnum) 
  8942. +            continue;
  8943. +        if(s->dead && (s->state == TCP_CLOSE))
  8944. +            continue;
  8945. +        if(prot == &udp_prot)
  8946. +            return s;
  8947. +        if(ip_addr_match(s->daddr,raddr)==0)
  8948. +            continue;
  8949. +        if (s->dummy_th.dest != rnum && s->dummy_th.dest != 0) 
  8950. +            continue;
  8951. +        if(ip_addr_match(s->saddr,laddr) == 0)
  8952. +            continue;
  8953. +        return(s);
  8954. +      }
  8955. +      return(NULL);
  8956. +}
  8957. +
  8958. +static struct proto_ops inet_proto_ops = {
  8959. +    AF_INET,
  8960. +
  8961. +    inet_create,
  8962. +    inet_dup,
  8963. +    inet_release,
  8964. +    inet_bind,
  8965. +    inet_connect,
  8966. +    inet_socketpair,
  8967. +    inet_accept,
  8968. +    inet_getname, 
  8969. +    inet_read,
  8970. +    inet_write,
  8971. +    inet_select,
  8972. +    inet_ioctl,
  8973. +    inet_listen,
  8974. +    inet_send,
  8975. +    inet_recv,
  8976. +    inet_sendto,
  8977. +    inet_recvfrom,
  8978. +    inet_shutdown,
  8979. +    inet_setsockopt,
  8980. +    inet_getsockopt,
  8981. +    inet_fcntl,
  8982. +};
  8983. +
  8984. +extern unsigned long seq_offset;
  8985. +
  8986. +/*
  8987. + *    Called by socket.c on kernel startup.  
  8988. + */
  8989. +void inet_proto_init(struct net_proto *pro)
  8990. +{
  8991. +    struct inet_protocol *p;
  8992. +    int i;
  8993. +
  8994. +    printk("Swansea University Computer Society NET3.014\n");
  8995. +
  8996. +    /*
  8997. +     *    Tell SOCKET that we are alive... 
  8998. +     */
  8999. +   
  9000. +      (void) sock_register(inet_proto_ops.family, &inet_proto_ops);
  9001. +
  9002. +      seq_offset = CURRENT_TIME*250;
  9003. +
  9004. +    /*
  9005. +     *    Add all the protocols. 
  9006. +     */
  9007. +     
  9008. +    for(i = 0; i < SOCK_ARRAY_SIZE; i++) 
  9009. +    {
  9010. +        tcp_prot.sock_array[i] = NULL;
  9011. +        udp_prot.sock_array[i] = NULL;
  9012. +        raw_prot.sock_array[i] = NULL;
  9013. +      }
  9014. +
  9015. +    printk("IP Protocols: ");
  9016. +    for(p = inet_protocol_base; p != NULL;) 
  9017. +    {
  9018. +        struct inet_protocol *tmp = (struct inet_protocol *) p->next;
  9019. +        inet_add_protocol(p);
  9020. +        printk("%s%s",p->name,tmp?", ":"\n");
  9021. +        p = tmp;
  9022. +    }
  9023. +    /*
  9024. +     *    Set the ARP module up
  9025. +     */
  9026. +    arp_init();
  9027. +      /*
  9028. +       *    Set the IP module up
  9029. +       */
  9030. +    ip_init();
  9031. +}
  9032. +
  9033. diff -u --new-file --recursive linux.old/net/inet/arp.c linux/net/inet/arp.c
  9034. --- linux.old/net/inet/arp.c    Fri May 20 18:47:38 1994
  9035. +++ linux/net/inet/arp.c    Fri May 20 18:50:37 1994
  9036. @@ -722,7 +722,17 @@
  9037.  {
  9038.      struct arp_table *entry;
  9039.      unsigned long hash;
  9040. -
  9041. +/* SHOULD BE FIXED NOW */    
  9042. +    if(paddr==0)
  9043. +    {
  9044. +        printk("ADDRESS BOTCH 0\n");
  9045. +        if(skb)
  9046. +        {
  9047. +            printk("skb(saddr=%lx, daddr=%lx, raddr=%lx)\n",
  9048. +                skb->saddr,skb->daddr,skb->raddr);
  9049. +        }
  9050. +    }    
  9051. +/* ------------- */
  9052.      switch (ip_chk_addr(paddr))
  9053.      {
  9054.          case IS_MYADDR:
  9055. @@ -1075,8 +1085,6 @@
  9056.  
  9057.      switch(cmd)
  9058.      {
  9059. -        case DDIOCSDBG:
  9060. -            return dbg_ioctl(arg, DBG_ARP);
  9061.          case SIOCDARP:
  9062.              if (!suser())
  9063.                  return -EPERM;
  9064. Only in linux.old/net/inet: arp.c.orig
  9065. Only in linux.old/net/inet: arp.h.orig
  9066. diff -u --new-file --recursive linux.old/net/inet/ax25_subr.c.re linux/net/inet/ax25_subr.c.re
  9067. --- linux.old/net/inet/ax25_subr.c.re    Thu Jan  1 01:00:00 1970
  9068. +++ linux/net/inet/ax25_subr.c.re    Fri May 20 18:50:48 1994
  9069. @@ -0,0 +1,16 @@
  9070. +***************
  9071. +*** 50,56 ****
  9072. +  #include <linux/string.h>
  9073. +  #include <linux/sockios.h>
  9074. +  #include <linux/net.h>
  9075. +- #include <linux/ddi.h>
  9076. +  #include "ax25.h"
  9077. +  #include <linux/inet.h>
  9078. +  #include <linux/netdevice.h>
  9079. +--- 50,55 ----
  9080. +  #include <linux/string.h>
  9081. +  #include <linux/sockios.h>
  9082. +  #include <linux/net.h>
  9083. +  #include "ax25.h"
  9084. +  #include <linux/inet.h>
  9085. +  #include <linux/netdevice.h>
  9086. Only in linux.old/net/inet: datagram.c.ori
  9087. diff -u --new-file --recursive linux.old/net/inet/datalink.h linux/net/inet/datalink.h
  9088. --- linux.old/net/inet/datalink.h    Thu Jan  1 01:00:00 1970
  9089. +++ linux/net/inet/datalink.h    Fri May 20 18:50:54 1994
  9090. @@ -0,0 +1,17 @@
  9091. +#ifndef _NET_INET_DATALINK_H_
  9092. +#define _NET_INET_DATALINK_H_
  9093. +
  9094. +struct datalink_proto {
  9095. +    unsigned short    type_len;
  9096. +    unsigned char    type[8];
  9097. +    unsigned short    datalink_type;
  9098. +    unsigned short    header_length;
  9099. +    int    (*rcvfunc)(struct sk_buff *, struct device *, 
  9100. +                struct packet_type *);
  9101. +    void    (*datalink_header)(struct datalink_proto *, struct sk_buff *,
  9102. +                    unsigned char *);
  9103. +    struct datalink_proto    *next;
  9104. +};
  9105. +
  9106. +#endif
  9107. +
  9108. diff -u --new-file --recursive linux.old/net/inet/dev.c linux/net/inet/dev.c
  9109. --- linux.old/net/inet/dev.c    Fri May 20 18:43:14 1994
  9110. +++ linux/net/inet/dev.c    Fri May 20 18:50:38 1994
  9111. @@ -14,6 +14,7 @@
  9112.   *    Additional Authors:
  9113.   *        Florian la Roche <rzsfl@rz.uni-sb.de>
  9114.   *        Alan Cox <gw4pts@gw4pts.ampr.org>
  9115. + *        David Hinds <dhinds@allegro.stanford.edu>
  9116.   *
  9117.   *    Cleaned up and recommented by Alan Cox 2nd April 1994. I hope to have
  9118.   *    the rest as well commented in the end.
  9119. @@ -136,7 +137,7 @@
  9120.      }
  9121.    
  9122.    /*
  9123. -   *    NIT taps must go at the end or inet_bh will leak!
  9124. +   *    NIT taps must go at the end or net_bh will leak!
  9125.     */
  9126.     
  9127.      if (pt->type == htons(ETH_P_ALL))
  9128. @@ -289,7 +290,9 @@
  9129.          /*
  9130.           *    Delete the route to the device.
  9131.           */
  9132. +#ifdef CONFIG_INET         
  9133.          ip_rt_flush(dev);
  9134. +#endif        
  9135.          /*
  9136.           *    Blank the IP addresses
  9137.           */
  9138. @@ -324,14 +327,19 @@
  9139.                  /* at the front or the back of the    */
  9140.                  /* queue.                */
  9141.  
  9142. -    DPRINTF((DBG_DEV, "dev_queue_xmit(skb=%X, dev=%X, pri = %d)\n",
  9143. -                            skb, dev, pri));
  9144. -
  9145.      if (dev == NULL) 
  9146.      {
  9147.          printk("dev.c: dev_queue_xmit: dev = NULL\n");
  9148.          return;
  9149.      }
  9150. +#ifdef CONFIG_SLAVE_BALANCING
  9151. +    save_flags(flags);
  9152. +    cli();
  9153. +    if(dev->slave!=NULL && dev->slave->pkt_queue < dev->pkt_queue &&
  9154. +                (dev->slave->flags & IFF_UP))
  9155. +        dev=dev->slave;
  9156. +    restore_flags(flags);
  9157. +#endif        
  9158.   
  9159.      IS_SKB(skb);
  9160.      
  9161. @@ -370,8 +378,8 @@
  9162.      }
  9163.  
  9164.      /*
  9165. -     *    If the address has not been resolved called the device header rebuilder.
  9166. -     *    This can cover all protocols and technically no just ARP either.
  9167. +     *    If the address has not been resolved. Call the device header rebuilder.
  9168. +     *    This can cover all protocols and technically not just ARP either.
  9169.       */
  9170.       
  9171.      if (!skb->arp && dev->rebuild_header(skb->data, dev, skb->raddr, skb)) {
  9172. @@ -381,12 +389,21 @@
  9173.      save_flags(flags);
  9174.      cli();    
  9175.      if (!where) {
  9176. +#ifdef CONFIG_SLAVE_BALANCING    
  9177. +        skb->in_dev_queue=1;
  9178. +#endif        
  9179.          skb_queue_tail(dev->buffs + pri,skb);
  9180.          skb = skb_dequeue(dev->buffs + pri);
  9181. +#ifdef CONFIG_SLAVE_BALANCING        
  9182. +        skb->in_dev_queue=0;
  9183. +#endif        
  9184.      }
  9185.      restore_flags(flags);
  9186.  
  9187.      if (dev->hard_start_xmit(skb, dev) == 0) {
  9188. +#ifdef CONFIG_SLAVE_BALANCING    
  9189. +        dev->pkt_queue--;
  9190. +#endif
  9191.          return;
  9192.      }
  9193.  
  9194. @@ -394,6 +411,10 @@
  9195.       *    Transmission failed, put skb back into a list. 
  9196.       */
  9197.      cli();
  9198. +#ifdef CONFIG_SLAVE_BALANCING
  9199. +    skb->in_dev_queue=1;
  9200. +    dev->pkt_queue++;
  9201. +#endif        
  9202.      skb_queue_head(dev->buffs + pri,skb);
  9203.      restore_flags(flags);
  9204.  }
  9205. @@ -447,7 +468,7 @@
  9206.       *    hardware interrupt returns.
  9207.       */
  9208.  
  9209. -    mark_bh(INET_BH);
  9210. +    mark_bh(NET_BH);
  9211.      return;
  9212.  }
  9213.  
  9214. @@ -573,7 +594,7 @@
  9215.   
  9216.  volatile char in_bh = 0;    /* Non-rentrant remember */
  9217.  
  9218. -int in_inet_bh()    /* Used by timer.c */
  9219. +int in_net_bh()    /* Used by timer.c */
  9220.  {
  9221.      return(in_bh==0?0:1);
  9222.  }
  9223. @@ -583,10 +604,10 @@
  9224.   *    on and hardware can interrupt and queue to the receive queue a we
  9225.   *    run with no problems.
  9226.   *    This is run as a bottom half after an interrupt handler that does
  9227. - *    mark_bh(INET_BH);
  9228. + *    mark_bh(NET_BH);
  9229.   */
  9230.   
  9231. -void inet_bh(void *tmp)
  9232. +void net_bh(void *tmp)
  9233.  {
  9234.      struct sk_buff *skb;
  9235.      struct packet_type *ptype;
  9236. @@ -724,7 +745,6 @@
  9237.       
  9238.          if (!flag) 
  9239.          {
  9240. -            DPRINTF((DBG_DEV,"INET: unknown packet type 0x%04X (ignored)\n", type));
  9241.              kfree_skb(skb, FREE_WRITE);
  9242.          }
  9243.  
  9244. @@ -995,10 +1015,21 @@
  9245.          case SIOCSIFFLAGS:    /* Set interface flags */
  9246.              {
  9247.                  int old_flags = dev->flags;
  9248. +#ifdef CONFIG_SLAVE_BALANCING                
  9249. +                if(dev->flags&IFF_SLAVE)
  9250. +                    return -EBUSY;
  9251. +#endif                    
  9252.                  dev->flags = ifr.ifr_flags & (
  9253.                      IFF_UP | IFF_BROADCAST | IFF_DEBUG | IFF_LOOPBACK |
  9254.                      IFF_POINTOPOINT | IFF_NOTRAILERS | IFF_RUNNING |
  9255. -                    IFF_NOARP | IFF_PROMISC | IFF_ALLMULTI);
  9256. +                    IFF_NOARP | IFF_PROMISC | IFF_ALLMULTI | IFF_SLAVE | IFF_MASTER);
  9257. +#ifdef CONFIG_SLAVE_BALANCING                
  9258. +                if(!(dev->flags&IFF_MASTER) && dev->slave)
  9259. +                {
  9260. +                    dev->slave->flags&=~IFF_SLAVE;
  9261. +                    dev->slave=NULL;
  9262. +                }
  9263. +#endif                
  9264.                  
  9265.                  /*
  9266.                   *    Has promiscuous mode been turned off
  9267. @@ -1053,7 +1084,12 @@
  9268.              dev->pa_addr = (*(struct sockaddr_in *)
  9269.                   &ifr.ifr_addr).sin_addr.s_addr;
  9270.              dev->family = ifr.ifr_addr.sa_family;
  9271. +            
  9272. +#ifdef CONFIG_INET    
  9273. +            /* This is naughty. When net-032e comes out It wants moving into the net032
  9274. +               code not the kernel. Till then it can sit here (SIGH) */        
  9275.              dev->pa_mask = ip_get_mask(dev->pa_addr);
  9276. +#endif            
  9277.              dev->pa_brdaddr = dev->pa_addr | ~dev->pa_mask;
  9278.              ret = 0;
  9279.              break;
  9280. @@ -1179,7 +1215,83 @@
  9281.                  return -EINVAL;
  9282.              ret=dev->set_mac_address(dev,ifr.ifr_hwaddr.sa_data);
  9283.              break;
  9284. +        
  9285. +        case SIOCDEVPRIVATE:
  9286. +            if(dev->do_ioctl==NULL)
  9287. +                return -EOPNOTSUPP;
  9288. +            return dev->do_ioctl(dev, &ifr);
  9289. +            
  9290. +        case SIOCGIFMAP:
  9291. +            ifr.ifr_map.mem_start=dev->mem_start;
  9292. +            ifr.ifr_map.mem_end=dev->mem_end;
  9293. +            ifr.ifr_map.base_addr=dev->base_addr;
  9294. +            ifr.ifr_map.irq=dev->irq;
  9295. +            ifr.ifr_map.dma=dev->dma;
  9296. +            ifr.ifr_map.port=dev->if_port;
  9297. +            memcpy_tofs(arg,&ifr,sizeof(struct ifreq));
  9298. +            ret=0;
  9299. +            break;
  9300.              
  9301. +        case SIOCSIFMAP:
  9302. +            if(dev->set_config==NULL)
  9303. +                return -EOPNOTSUPP;
  9304. +            return dev->set_config(dev,&ifr.ifr_map);
  9305. +            
  9306. +        case SIOCGIFSLAVE:
  9307. +#ifdef CONFIG_SLAVE_BALANCING        
  9308. +            if(dev->slave==NULL)
  9309. +                return -ENOENT;
  9310. +            strncpy(ifr.ifr_name,dev->name,sizeof(ifr.ifr_name));
  9311. +            memcpy_tofs(arg,&ifr,sizeof(struct ifreq));
  9312. +            ret=0;
  9313. +#else
  9314. +            return -ENOENT;
  9315. +#endif            
  9316. +            break;
  9317. +#ifdef CONFIG_SLAVE_BALANCING            
  9318. +        case SIOCSIFSLAVE:
  9319. +        {
  9320. +        
  9321. +        /*
  9322. +         *    Fun game. Get the device up and the flags right without
  9323. +         *    letting some scummy user confuse us.
  9324. +         */
  9325. +            unsigned long flags;
  9326. +            struct device *slave=dev_get(ifr.ifr_slave);
  9327. +            save_flags(flags);
  9328. +            if(slave==NULL)
  9329. +            {
  9330. +                return -ENODEV;
  9331. +            }
  9332. +            cli();
  9333. +            if(slave->flags&(IFF_UP|IFF_RUNNING)!=(IFF_UP|IFF_RUNNING))
  9334. +            {
  9335. +                restore_flags(flags);
  9336. +                return -EINVAL;
  9337. +            }
  9338. +            if(dev->flags&IFF_SLAVE)
  9339. +            {
  9340. +                restore_flags(flags);
  9341. +                return -EINVAL;
  9342. +            }
  9343. +            if(dev->slave!=NULL)
  9344. +            {
  9345. +                restore_flags(flags);
  9346. +                return -EBUSY;
  9347. +            }
  9348. +            if(slave->flags&IFF_SLAVE)
  9349. +            {
  9350. +                restore_flags(flags);
  9351. +                return -EBUSY;
  9352. +            }
  9353. +            dev->slave=slave;
  9354. +            slave->flags|=IFF_SLAVE;
  9355. +            dev->flags|=IFF_MASTER;
  9356. +            restore_flags(flags);
  9357. +            ret=0;
  9358. +        }
  9359. +        break;
  9360. +#endif            
  9361.          /*
  9362.           *    Unknown ioctl
  9363.           */
  9364. @@ -1224,6 +1336,8 @@
  9365.          case SIOCGIFHWADDR:
  9366.          case SIOCSIFHWADDR:
  9367.          case OLD_SIOCGIFHWADDR:
  9368. +        case SIOCGIFSLAVE:
  9369. +        case SIOCGIFMAP:
  9370.              return dev_ifsioc(arg, cmd);
  9371.  
  9372.          /*
  9373. @@ -1238,6 +1352,9 @@
  9374.          case SIOCSIFMETRIC:
  9375.          case SIOCSIFMTU:
  9376.          case SIOCSIFMEM:
  9377. +        case SIOCSIFMAP:
  9378. +        case SIOCSIFSLAVE:
  9379. +        case SIOCDEVPRIVATE:
  9380.              if (!suser())
  9381.                  return -EPERM;
  9382.              return dev_ifsioc(arg, cmd);
  9383. Only in linux.old/net/inet: dev.c.orig
  9384. diff -u --new-file --recursive linux.old/net/inet/dev.h linux/net/inet/dev.h
  9385. --- linux.old/net/inet/dev.h    Tue Dec 14 10:12:07 1993
  9386. +++ linux/net/inet/dev.h    Fri May 20 18:50:38 1994
  9387. @@ -1,191 +0,0 @@
  9388. -/*
  9389. - * INET        An implementation of the TCP/IP protocol suite for the LINUX
  9390. - *        operating system.  INET is implemented using the  BSD Socket
  9391. - *        interface as the means of communication with the user level.
  9392. - *
  9393. - *        Definitions for the Interfaces handler.
  9394. - *
  9395. - * Version:    @(#)dev.h    1.0.10    08/12/93
  9396. - *
  9397. - * Authors:    Ross Biro, <bir7@leland.Stanford.Edu>
  9398. - *        Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  9399. - *        Corey Minyard <wf-rch!minyard@relay.EU.net>
  9400. - *        Donald J. Becker, <becker@super.org>
  9401. - *
  9402. - *        This program is free software; you can redistribute it and/or
  9403. - *        modify it under the terms of the GNU General Public License
  9404. - *        as published by the Free Software Foundation; either version
  9405. - *        2 of the License, or (at your option) any later version.
  9406. - */
  9407. -#ifndef _DEV_H
  9408. -#define _DEV_H
  9409. -
  9410. -#include <linux/if.h>
  9411. -#include <linux/if_ether.h>
  9412. -
  9413. -
  9414. -/* for future expansion when we will have different priorities. */
  9415. -#define DEV_NUMBUFFS    3
  9416. -#define MAX_ADDR_LEN    7
  9417. -#define MAX_HEADER    18
  9418. -
  9419. -#define IS_MYADDR    1        /* address is (one of) our own    */
  9420. -#define IS_LOOPBACK    2        /* address is for LOOPBACK    */
  9421. -#define IS_BROADCAST    3        /* address is a valid broadcast    */
  9422. -#define IS_INVBCAST    4        /* Wrong netmask bcast not for us */
  9423. -
  9424. -/*
  9425. - * The DEVICE structure.
  9426. - * Actually, this whole structure is a big mistake.  It mixes I/O
  9427. - * data with strictly "high-level" data, and it has to know about
  9428. - * almost every data structure used in the INET module.  We will
  9429. - * gradually phase out this structure, and replace it with the
  9430. - * more general (but stolen :-) BSD "ifnet" structure. -FvK
  9431. - */
  9432. -struct device {
  9433. -
  9434. -  /*
  9435. -   * This is the first field of the "visible" part of this structure
  9436. -   * (i.e. as seen by users in the "Space.c" file).  It is the name
  9437. -   * the interface.
  9438. -   */
  9439. -  char              *name;
  9440. -
  9441. -  /* I/O specific fields.  These will be moved to DDI soon. */
  9442. -  unsigned long          rmem_end;        /* shmem "recv" end    */
  9443. -  unsigned long          rmem_start;        /* shmem "recv" start    */
  9444. -  unsigned long          mem_end;        /* sahared mem end    */
  9445. -  unsigned long          mem_start;        /* shared mem start    */
  9446. -  unsigned short      base_addr;        /* device I/O address    */
  9447. -  unsigned char          irq;            /* device IRQ number    */
  9448. -
  9449. -  /* Low-level status flags. */
  9450. -  volatile unsigned char  start,        /* start an operation    */
  9451. -                          tbusy,        /* transmitter busy    */
  9452. -                          interrupt;        /* interrupt arrived    */
  9453. -
  9454. -  /*
  9455. -   * Another mistake.
  9456. -   * This points to the next device in the "dev" chain. It will
  9457. -   * be moved to the "invisible" part of the structure as soon as
  9458. -   * it has been cleaned up. -FvK
  9459. -   */
  9460. -  struct device          *next;
  9461. -
  9462. -  /* The device initialization function. Called only once. */
  9463. -  int              (*init)(struct device *dev);
  9464. -
  9465. -  /* Some hardware also needs these fields, but they are not part of the
  9466. -     usual set specified in Space.c. */
  9467. -  unsigned char          if_port;        /* Selectable AUI, TP,..*/
  9468. -  unsigned char          dma;            /* DMA channel        */
  9469. -
  9470. -  struct enet_statistics* (*get_stats)(struct device *dev);
  9471. -
  9472. -  /*
  9473. -   * This marks the end of the "visible" part of the structure. All
  9474. -   * fields hereafter are internal to the system, and may change at
  9475. -   * will (read: may be cleaned up at will).
  9476. -   */
  9477. -
  9478. -  /* These may be needed for future network-power-down code. */
  9479. -  unsigned long          trans_start;    /* Time (in jiffies) of last Tx    */
  9480. -  unsigned long          last_rx;    /* Time of last Rx        */
  9481. -
  9482. -  unsigned short      flags;    /* interface flags (a la BSD)    */
  9483. -  unsigned short      family;    /* address family ID (AF_INET)    */
  9484. -  unsigned short      metric;    /* routing metric (not used)    */
  9485. -  unsigned short      mtu;        /* interface MTU value        */
  9486. -  unsigned short      type;        /* interface hardware type    */
  9487. -  unsigned short      hard_header_len;    /* hardware hdr length    */
  9488. -  void              *priv;    /* pointer to private data    */
  9489. -
  9490. -  /* Interface address info. */
  9491. -  unsigned char          broadcast[MAX_ADDR_LEN];    /* hw bcast add    */
  9492. -  unsigned char          dev_addr[MAX_ADDR_LEN];    /* hw address    */
  9493. -  unsigned char          addr_len;    /* harfware address length    */
  9494. -  unsigned long          pa_addr;    /* protocol address        */
  9495. -  unsigned long          pa_brdaddr;    /* protocol broadcast addr    */
  9496. -  unsigned long          pa_dstaddr;    /* protocol P-P other side addr    */
  9497. -  unsigned long          pa_mask;    /* protocol netmask        */
  9498. -  unsigned short      pa_alen;    /* protocol address length    */
  9499. -
  9500. -  /* Pointer to the interface buffers. */
  9501. -  struct sk_buff      *volatile buffs[DEV_NUMBUFFS];
  9502. -
  9503. -  /* Pointers to interface service routines. */
  9504. -  int              (*open)(struct device *dev);
  9505. -  int              (*stop)(struct device *dev);
  9506. -  int              (*hard_start_xmit) (struct sk_buff *skb,
  9507. -                          struct device *dev);
  9508. -  int              (*hard_header) (unsigned char *buff,
  9509. -                      struct device *dev,
  9510. -                      unsigned short type,
  9511. -                      unsigned long daddr,
  9512. -                      unsigned long saddr,
  9513. -                      unsigned len);
  9514. -  void              (*add_arp) (unsigned long addr,
  9515. -                      struct sk_buff *skb,
  9516. -                      struct device *dev);
  9517. -  void              (*queue_xmit)(struct sk_buff *skb,
  9518. -                    struct device *dev, int pri);
  9519. -  int              (*rebuild_header)(void *eth, struct device *dev);
  9520. -  unsigned short      (*type_trans) (struct sk_buff *skb,
  9521. -                     struct device *dev);
  9522. -#define HAVE_MULTICAST             
  9523. -  void              (*set_multicast_list)(struct device *dev,
  9524. -                       int num_addrs, void *addrs);
  9525. -#define HAVE_SET_MAC_ADDR           
  9526. -  int              (*set_mac_address)(struct device *dev, void *addr);
  9527. -};
  9528. -
  9529. -
  9530. -struct packet_type {
  9531. -  unsigned short    type;    /* This is really NET16(ether_type) other
  9532. -                 * devices will have to translate
  9533. -                 * appropriately.
  9534. -                 */
  9535. -  unsigned short    copy:1;
  9536. -  int            (*func) (struct sk_buff *, struct device *,
  9537. -                 struct packet_type *);
  9538. -  void            *data;
  9539. -  struct packet_type    *next;
  9540. -};
  9541. -
  9542. -
  9543. -/* Used by dev_rint */
  9544. -#define IN_SKBUFF    1
  9545. -#define DEV_QUEUE_MAGIC    0x17432895
  9546. -
  9547. -
  9548. -extern struct device    *dev_base;
  9549. -extern struct packet_type *ptype_base;
  9550. -
  9551. -
  9552. -extern int        ip_addr_match(unsigned long addr1, unsigned long addr2);
  9553. -extern int        chk_addr(unsigned long addr);
  9554. -extern struct device    *dev_check(unsigned long daddr);
  9555. -extern unsigned long    my_addr(void);
  9556. -
  9557. -extern void        dev_add_pack(struct packet_type *pt);
  9558. -extern void        dev_remove_pack(struct packet_type *pt);
  9559. -extern struct device    *dev_get(char *name);
  9560. -extern int        dev_open(struct device *dev);
  9561. -extern int        dev_close(struct device *dev);
  9562. -extern void        dev_queue_xmit(struct sk_buff *skb, struct device *dev,
  9563. -                       int pri);
  9564. -#define HAVE_NETIF_RX 1
  9565. -extern void        netif_rx(struct sk_buff *skb);
  9566. -/* The old interface to netif_rx(). */
  9567. -extern int        dev_rint(unsigned char *buff, long len, int flags,
  9568. -                 struct device * dev);
  9569. -extern void        dev_transmit(void);
  9570. -extern int        in_inet_bh(void);
  9571. -extern void        inet_bh(void *tmp);
  9572. -extern void        dev_tint(struct device *dev);
  9573. -extern int        dev_get_info(char *buffer);
  9574. -extern int        dev_ioctl(unsigned int cmd, void *);
  9575. -
  9576. -extern void        dev_init(void);
  9577. -
  9578. -#endif    /* _DEV_H */
  9579. diff -u --new-file --recursive linux.old/net/inet/devinet.c linux/net/inet/devinet.c
  9580. --- linux.old/net/inet/devinet.c    Fri May 20 18:42:41 1994
  9581. +++ linux/net/inet/devinet.c    Fri May 20 18:50:43 1994
  9582. @@ -75,8 +75,6 @@
  9583.  {
  9584.      int i;
  9585.      unsigned long mask=0xFFFFFFFF;
  9586. -    DPRINTF((DBG_DEV, "ip_addr_match(%s, ", in_ntoa(me)));
  9587. -    DPRINTF((DBG_DEV, "%s)\n", in_ntoa(him)));
  9588.  
  9589.      /*
  9590.       *    Simple case
  9591. @@ -196,7 +194,7 @@
  9592.   *
  9593.   *    Because the loopback address (127.0.0.1) is already recognized
  9594.   *    automatically, we can use the loopback interface's address as
  9595. - *    our "primary" interface.  This is the addressed used by IP et
  9596. + *    our "primary" interface.  This is the address used by IP et
  9597.   *    al when it doesn't know which address to use (i.e. it does not
  9598.   *    yet know from or to which interface to go...).
  9599.   */
  9600. Only in linux.old/net/inet: devinet.c.orig
  9601. diff -u --new-file --recursive linux.old/net/inet/eth.c linux/net/inet/eth.c
  9602. --- linux.old/net/inet/eth.c    Fri May 20 18:42:41 1994
  9603. +++ linux/net/inet/eth.c    Fri May 20 18:50:38 1994
  9604. @@ -23,6 +23,8 @@
  9605.   *        Florian        : Removed many unnecessary functions, code cleanup
  9606.   *                  and changes for new arp and skbuff.
  9607.   *        Alan Cox    : Redid header building to reflect new format.
  9608. + *        Alan Cox    : ARP only when compiled with CONFIG_INET
  9609. + *        Greg Page    : 802.2 and SNAP stuff
  9610.   *
  9611.   *        This program is free software; you can redistribute it and/or
  9612.   *        modify it under the terms of the GNU General Public License
  9613. @@ -147,8 +149,11 @@
  9614.      /*
  9615.       *    Try and get ARP to resolve the header.
  9616.       */
  9617. -     
  9618. +#ifdef CONFIG_INET     
  9619.      return arp_find(eth->h_dest, dst, dev, dev->pa_addr, skb)? 1 : 0;
  9620. +#else
  9621. +    return 0;    
  9622. +#endif    
  9623.  }
  9624.  
  9625.  
  9626. @@ -161,10 +166,17 @@
  9627.  unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev)
  9628.  {
  9629.      struct ethhdr *eth = (struct ethhdr *) skb->data;
  9630. +    char *rawp;
  9631.  
  9632. -    if (ntohs(eth->h_proto) < 1536)
  9633. +    if (ntohs(eth->h_proto) >= 1536)
  9634. +        return eth->h_proto;
  9635. +        
  9636. +    rawp = (unsigned char *)(eth + 1);
  9637. +    
  9638. +    if (*(unsigned short *)rawp == 0xFFFF)
  9639.          return htons(ETH_P_802_3);
  9640. -
  9641. -    return eth->h_proto;
  9642. +    if (*(unsigned short *)rawp == 0xAAAA)
  9643. +        return htons(ETH_P_SNAP);
  9644. +        
  9645. +    return htons(ETH_P_802_2);
  9646.  }
  9647. -
  9648. Only in linux.old/net/inet: eth.c.orig
  9649. diff -u --new-file --recursive linux.old/net/inet/icmp.c linux/net/inet/icmp.c
  9650. --- linux.old/net/inet/icmp.c    Fri May 20 18:46:37 1994
  9651. +++ linux/net/inet/icmp.c    Fri May 20 18:50:38 1994
  9652. @@ -19,12 +19,11 @@
  9653.   *        Alan Cox    :    Protocol violations
  9654.   *        Alan Cox    :    SNMP Statistics        
  9655.   *        Alan Cox    :    Routing errors
  9656. + *        Alan Cox    :    Changes for newer routing code
  9657. + *        Alan Cox    :    Removed old debugging junk
  9658.   *
  9659.   * 
  9660. - *    FIXME:
  9661. - *        When 1.0.6 is out merge in the NET channel diffs for TIMESTAMP
  9662.   *
  9663. - *
  9664.   *        This program is free software; you can redistribute it and/or
  9665.   *        modify it under the terms of the GNU General Public License
  9666.   *        as published by the Free Software Foundation; either version
  9667. @@ -82,21 +81,6 @@
  9668.  };
  9669.  
  9670.  
  9671. -/* 
  9672. - *    Display the contents of an ICMP header. 
  9673. - */
  9674. -static void print_icmp(struct icmphdr *icmph)
  9675. -{
  9676. -      if (inet_debug != DBG_ICMP) 
  9677. -          return;
  9678. -
  9679. -      printk("ICMP: type = %d, code = %d, checksum = %X\n",
  9680. -            icmph->type, icmph->code, icmph->checksum);
  9681. -      printk("      gateway = %s\n", in_ntoa(icmph->un.gateway));
  9682. -}
  9683. -
  9684. -
  9685.  /*
  9686.   *    Send an ICMP message in response to a situation
  9687.   *
  9688. @@ -112,9 +96,6 @@
  9689.      int len;
  9690.      struct device *ndev=NULL;    /* Make this =dev to force replies on the same interface */
  9691.  
  9692. -    DPRINTF((DBG_ICMP, "icmp_send(skb_in = %X, type = %d, code = %d, dev=%X)\n",
  9693. -                           skb_in, type, code, dev));
  9694. -
  9695.      /*
  9696.       *    Find the original IP header.
  9697.       */
  9698. @@ -223,9 +204,6 @@
  9699.      icmph->checksum = ip_compute_csum((unsigned char *)icmph,
  9700.                           sizeof(struct icmphdr) + sizeof(struct iphdr) + 8);
  9701.  
  9702. -    DPRINTF((DBG_ICMP, ">>\n"));
  9703. -    print_icmp(icmph);
  9704. -
  9705.      /*
  9706.       *    Send it and free it once sent.
  9707.       */
  9708. @@ -250,20 +228,14 @@
  9709.      switch(icmph->code & 7) 
  9710.      {
  9711.          case ICMP_NET_UNREACH:
  9712. -            DPRINTF((DBG_ICMP, "ICMP: %s: network unreachable.\n",
  9713. -                                in_ntoa(iph->daddr)));
  9714.              break;
  9715.          case ICMP_HOST_UNREACH:
  9716. -            DPRINTF((DBG_ICMP, "ICMP: %s: host unreachable.\n",
  9717. -                            in_ntoa(iph->daddr)));
  9718.              break;
  9719.          case ICMP_PROT_UNREACH:
  9720.              printk("ICMP: %s:%d: protocol unreachable.\n",
  9721.                  in_ntoa(iph->daddr), ntohs(iph->protocol));
  9722.              break;
  9723.          case ICMP_PORT_UNREACH:
  9724. -            DPRINTF((DBG_ICMP, "ICMP: %s:%d: port unreachable.\n",
  9725. -                in_ntoa(iph->daddr), -1 /* FIXME: ntohs(iph->port) */));
  9726.              break;
  9727.          case ICMP_FRAG_NEEDED:
  9728.              printk("ICMP: %s: fragmentation needed and DF set.\n",
  9729. @@ -273,8 +245,6 @@
  9730.              printk("ICMP: %s: Source Route Failed.\n", in_ntoa(iph->daddr));
  9731.              break;
  9732.          default:
  9733. -            DPRINTF((DBG_ICMP, "ICMP: Unreachable: CODE=%d from %s\n",
  9734. -                        (icmph->code & 7), in_ntoa(iph->daddr)));
  9735.              break;
  9736.      }
  9737.  
  9738. @@ -338,7 +308,7 @@
  9739.               */
  9740.  #ifdef not_a_good_idea
  9741.              ip_rt_add((RTF_DYNAMIC | RTF_MODIFIED | RTF_GATEWAY),
  9742. -                ip, 0, icmph->un.gateway, dev);
  9743. +                ip, 0, icmph->un.gateway, dev,0);
  9744.              break;
  9745.  #endif
  9746.          case ICMP_REDIR_HOST:
  9747. @@ -354,16 +324,14 @@
  9748.                  break;
  9749.              printk("redirect from %08lx\n", source);
  9750.              ip_rt_add((RTF_DYNAMIC | RTF_MODIFIED | RTF_HOST | RTF_GATEWAY),
  9751. -                ip, 0, icmph->un.gateway, dev);
  9752. +                ip, 0, icmph->un.gateway, dev,0);
  9753.              break;
  9754.          case ICMP_REDIR_NETTOS:
  9755.          case ICMP_REDIR_HOSTTOS:
  9756.              printk("ICMP: cannot handle TOS redirects yet!\n");
  9757.              break;
  9758.          default:
  9759. -            DPRINTF((DBG_ICMP, "ICMP: Unreach: CODE=%d\n",
  9760. -                        (icmph->code & 7)));
  9761. -        break;
  9762. +            break;
  9763.        }
  9764.        
  9765.        /*
  9766. @@ -620,8 +588,6 @@
  9767.       
  9768.      if (ip_chk_addr(daddr) == IS_BROADCAST) 
  9769.      {
  9770. -        DPRINTF((DBG_ICMP, "ICMP: Discarded broadcast from %s\n",
  9771. -                            in_ntoa(saddr)));
  9772.          icmp_statistics.IcmpInErrors++;
  9773.          kfree_skb(skb1, FREE_READ);
  9774.          return(0);
  9775. @@ -646,7 +612,6 @@
  9776.          kfree_skb(skb1, FREE_READ);
  9777.          return(0);
  9778.      }
  9779. -    print_icmp(icmph);
  9780.  
  9781.      /*
  9782.       *    Parse the ICMP message 
  9783. @@ -708,9 +673,6 @@
  9784.              return(0);
  9785.          default:
  9786.              icmp_statistics.IcmpInErrors++;
  9787. -            DPRINTF((DBG_ICMP,
  9788. -                "ICMP: Unsupported ICMP from %s, type = 0x%X\n",
  9789. -                            in_ntoa(saddr), icmph->type));
  9790.              kfree_skb(skb1, FREE_READ);
  9791.              return(0);
  9792.       }
  9793. @@ -729,8 +691,6 @@
  9794.  {
  9795.        switch(cmd) 
  9796.        {
  9797. -        case DDIOCSDBG:
  9798. -            return(dbg_ioctl((void *) arg, DBG_ICMP));
  9799.          default:
  9800.              return(-EINVAL);
  9801.        }
  9802. Only in linux.old/net/inet: icmp.c.orig
  9803. Only in linux.old/net/inet: icmp.h.orig
  9804. diff -u --new-file --recursive linux.old/net/inet/inet.h linux/net/inet/inet.h
  9805. --- linux.old/net/inet/inet.h    Thu Dec 30 12:17:28 1993
  9806. +++ linux/net/inet/inet.h    Fri May 20 18:50:40 1994
  9807. @@ -1,97 +0,0 @@
  9808. -/*
  9809. - * INET        An implementation of the TCP/IP protocol suite for the LINUX
  9810. - *        operating system.  INET is implemented using the  BSD Socket
  9811. - *        interface as the means of communication with the user level.
  9812. - *
  9813. - *        General Definitions for the TCP/IP (INET) module. This is
  9814. - *        mostly a bunch of "general" macros, plus the PROTOCOL link
  9815. - *        code and data.
  9816. - *
  9817. - * Version:    @(#)inet.h    1.0.6    05/25/93
  9818. - *
  9819. - * Author:    Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  9820. - *
  9821. - *        This work was derived friom Ross Biro's inspirational work
  9822. - *        for the LINUX operating system.  His version numbers were:
  9823. - *
  9824. - *        $Id: Space.c,v     0.8.4.5  1992/12/12 19:25:04 bir7 Exp $
  9825. - *        $Id: arp.c,v       0.8.4.6  1993/01/28 22:30:00 bir7 Exp $
  9826. - *        $Id: arp.h,v       0.8.4.6  1993/01/28 22:30:00 bir7 Exp $
  9827. - *        $Id: dev.c,v       0.8.4.13 1993/01/23 18:00:11 bir7 Exp $
  9828. - *        $Id: dev.h,v       0.8.4.7  1993/01/23 18:00:11 bir7 Exp $
  9829. - *        $Id: eth.c,v       0.8.4.4  1993/01/22 23:21:38 bir7 Exp $
  9830. - *        $Id: eth.h,v       0.8.4.1  1992/11/10 00:17:18 bir7 Exp $
  9831. - *        $Id: icmp.c,v      0.8.4.9  1993/01/23 18:00:11 bir7 Exp $
  9832. - *        $Id: icmp.h,v      0.8.4.2  1992/11/15 14:55:30 bir7 Exp $
  9833. - *         $Id: ip.c,v        0.8.4.8  1992/12/12 19:25:04 bir7 Exp $
  9834. - *         $Id: ip.h,v        0.8.4.2  1993/01/23 18:00:11 bir7 Exp $
  9835. - *         $Id: loopback.c,v  0.8.4.8  1993/01/23 18:00:11 bir7 Exp $
  9836. - *         $Id: packet.c,v    0.8.4.7  1993/01/26 22:04:00 bir7 Exp $
  9837. - *        $Id: protocols.c,v 0.8.4.3  1992/11/15 14:55:30 bir7 Exp $
  9838. - *        $Id: raw.c,v       0.8.4.12 1993/01/26 22:04:00 bir7 Exp $
  9839. - *        $Id: sock.c,v      0.8.4.6  1993/01/28 22:30:00 bir7 Exp $
  9840. - *        $Id: sock.h,v      0.8.4.7  1993/01/26 22:04:00 bir7 Exp $
  9841. - *        $Id: tcp.c,v       0.8.4.16 1993/01/26 22:04:00 bir7 Exp $
  9842. - *        $Id: tcp.h,v       0.8.4.7  1993/01/22 22:58:08 bir7 Exp $
  9843. - *        $Id: timer.c,v     0.8.4.8  1993/01/23 18:00:11 bir7 Exp $
  9844. - *        $Id: timer.h,v     0.8.4.2  1993/01/23 18:00:11 bir7 Exp $
  9845. - *        $Id: udp.c,v       0.8.4.12 1993/01/26 22:04:00 bir7 Exp $
  9846. - *        $Id: udp.h,v       0.8.4.1  1992/11/10 00:17:18 bir7 Exp $
  9847. - *        $Id: we.c,v        0.8.4.10 1993/01/23 18:00:11 bir7 Exp $
  9848. - *        $Id: wereg.h,v     0.8.4.1  1992/11/10 00:17:18 bir7 Exp $
  9849. - *
  9850. - *        This program is free software; you can redistribute it and/or
  9851. - *        modify it under the terms of the GNU General Public License
  9852. - *        as published by the Free Software Foundation; either version
  9853. - *        2 of the License, or (at your option) any later version.
  9854. - */
  9855. -#ifndef _INET_H
  9856. -#define _INET_H
  9857. -
  9858. -
  9859. -#include <linux/ddi.h>
  9860. -
  9861. -
  9862. -#define NET16(x)    ((((x) >> 8) & 0x00FF) | (((x) << 8) & 0xFF00))
  9863. -
  9864. -
  9865. -#undef    INET_DEBUG
  9866. -#ifdef    INET_DEBUG
  9867. -#  define    DPRINTF(x)    dprintf x 
  9868. -#else
  9869. -#   define    DPRINTF(x)    do ; while (0)
  9870. -#endif
  9871. -
  9872. -/* Debug levels. One per module. */
  9873. -#define DBG_OFF        0            /* no debugging        */
  9874. -#define DBG_INET    1            /* sock.c        */
  9875. -#define DBG_RT        2            /* route.c        */
  9876. -#define DBG_DEV        3            /* dev.c        */
  9877. -#define DBG_ETH        4            /* eth.c        */
  9878. -#define DBG_PROTO    5            /* protocol.c        */
  9879. -#define DBG_TMR        6            /* timer.c        */
  9880. -#define DBG_PKT        7            /* packet.c        */
  9881. -#define DBG_RAW        8            /* raw.c        */
  9882. -
  9883. -#define DBG_LOOPB    10            /* loopback.c        */
  9884. -#define DBG_SLIP    11            /* slip.c        */
  9885. -
  9886. -#define DBG_ARP        20            /* arp.c        */
  9887. -#define DBG_IP        21            /* ip.c            */
  9888. -#define DBG_ICMP    22            /* icmp.c        */
  9889. -#define DBG_TCP        23            /* tcp.c        */
  9890. -#define DBG_UDP        24            /* udp.c        */
  9891. -
  9892. -
  9893. -extern int        inet_debug;
  9894. -
  9895. -
  9896. -extern void        inet_proto_init(struct ddi_proto *pro);
  9897. -extern char        *in_ntoa(unsigned long in);
  9898. -extern unsigned long    in_aton(char *str);
  9899. -
  9900. -extern void        dprintf(int level, char *fmt, ...);
  9901. -
  9902. -extern int        dbg_ioctl(void *arg, int level);
  9903. -
  9904. -#endif    /* _INET_H */
  9905. diff -u --new-file --recursive linux.old/net/inet/ip.c linux/net/inet/ip.c
  9906. --- linux.old/net/inet/ip.c    Fri May 20 18:47:40 1994
  9907. +++ linux/net/inet/ip.c    Fri May 20 18:50:38 1994
  9908. @@ -50,10 +50,11 @@
  9909.   *        Alan Cox    :    BSD address rule semantics. Also see
  9910.   *                    UDP as there is a nasty checksum issue
  9911.   *                    if you do things the wrong way.
  9912. + *        Alan Cox    :    Always defrag, moved IP_FORWARD to the config.in file
  9913.   *
  9914.   * To Fix:
  9915.   *        IP option processing is mostly not needed. ip_forward needs to know about routing rules
  9916. - *        and time stamp but that's about all.
  9917. + *        and time stamp but that's about all. Use the route mtu field here too
  9918.   *
  9919.   *        This program is free software; you can redistribute it and/or
  9920.   *        modify it under the terms of the GNU General Public License
  9921. @@ -83,7 +84,6 @@
  9922.  #include "arp.h"
  9923.  #include "icmp.h"
  9924.  
  9925. -#define CONFIG_IP_FORWARD
  9926.  #define CONFIG_IP_DEFRAG
  9927.  
  9928.  extern int last_retran;
  9929. @@ -97,67 +97,6 @@
  9930.   
  9931.  struct ip_mib ip_statistics={1,64,};    /* Forwarding=Yes, Default TTL=64 */
  9932.   
  9933. -/* 
  9934. - *    Print an IP packet for debugging purposes.
  9935. - *
  9936. - *    This function is exported for the IP
  9937. - *    upper layers to use also.
  9938. - */
  9939. -void ip_print(const struct iphdr *ip)
  9940. -{
  9941. -    unsigned char buff[32];
  9942. -    unsigned char *ptr;
  9943. -    int addr;
  9944. -    int len;
  9945. -    int i;
  9946. -
  9947. -    /* Are we debugging IP frames */
  9948. -    
  9949. -      if (inet_debug != DBG_IP) 
  9950. -          return;
  9951. -
  9952. -    /* Dump the IP header. */
  9953. -    printk("IP: ihl=%d, version=%d, tos=%d, tot_len=%d\n",
  9954. -        ip->ihl, ip->version, ip->tos, ntohs(ip->tot_len));
  9955. -    printk("    id=%X, ttl=%d, prot=%d, check=%X\n",
  9956. -        ip->id, ip->ttl, ip->protocol, ip->check);
  9957. -    printk("    frag_off=%d\n", ip->frag_off);
  9958. -    printk("    soucre=%s ", in_ntoa(ip->saddr));
  9959. -    printk("dest=%s\n", in_ntoa(ip->daddr));
  9960. -    printk("    ----\n");
  9961. -
  9962. -    /* Dump the data. */
  9963. -    ptr = (unsigned char *)(ip + 1);
  9964. -    addr = 0;
  9965. -    len = ntohs(ip->tot_len) - (4 * ip->ihl);
  9966. -
  9967. -    while (len > 0) 
  9968. -    {
  9969. -        printk("    %04X: ", addr);
  9970. -        for(i = 0; i < 16; i++) 
  9971. -        {
  9972. -            if (len > 0) 
  9973. -            {
  9974. -                printk("%02X ", (*ptr & 0xFF));
  9975. -                buff[i] = *ptr++;
  9976. -                if (buff[i] < 32 || buff[i] > 126) 
  9977. -                    buff[i] = '.';
  9978. -            } 
  9979. -            else 
  9980. -            {
  9981. -                printk("   ");
  9982. -                buff[i] = ' ';
  9983. -            }
  9984. -            addr++;
  9985. -            len--;
  9986. -        };
  9987. -        buff[i] = '\0';
  9988. -        printk("  \"%s\"\n", buff);
  9989. -      }
  9990. -      printk("    ----\n\n");
  9991. -}
  9992. -
  9993.  /*
  9994.   *    Handle the issuing of an ioctl() request 
  9995.   *    for the ip device. This is scheduled to
  9996. @@ -168,8 +107,6 @@
  9997.  {
  9998.        switch(cmd) 
  9999.        {
  10000. -        case DDIOCSDBG:
  10001. -            return(dbg_ioctl((void *) arg, DBG_IP));
  10002.          default:
  10003.              return(-EINVAL);
  10004.        }
  10005. @@ -190,12 +127,6 @@
  10006.  }
  10007.  
  10008.  
  10009. -static void
  10010. -print_ipprot(struct inet_protocol *ipprot)
  10011. -{
  10012. -  DPRINTF((DBG_IP, "handler = %X, protocol = %d, copy=%d \n",
  10013. -       ipprot->handler, ipprot->protocol, ipprot->copy));
  10014. -}
  10015.  
  10016.  
  10017.  /* This routine will check to see if we have lost a gateway. */
  10018. @@ -272,10 +203,6 @@
  10019.        if (saddr == 0) 
  10020.            saddr = ip_my_addr();
  10021.       
  10022. -    DPRINTF((DBG_IP, "ip_build_header (skb=%X, saddr=%X, daddr=%X, *dev=%X,\n"
  10023. -           "                 type=%d, opt=%X, len = %d)\n",
  10024. -           skb, saddr, daddr, *dev, type, opt, len));
  10025. -       
  10026.      buff = skb->data;
  10027.  
  10028.      /* 
  10029. @@ -303,7 +230,6 @@
  10030.              saddr = src;/*rt->rt_dev->pa_addr;*/
  10031.          raddr = rt->rt_gateway;
  10032.  
  10033. -        DPRINTF((DBG_IP, "ip_build_header: saddr set to %s\n", in_ntoa(saddr)));
  10034.          opt = &optmem;
  10035.      } 
  10036.      else 
  10037. @@ -754,8 +680,7 @@
  10038.         struct ipq *qp;
  10039.   
  10040.         qp = (struct ipq *)arg;
  10041. -       DPRINTF((DBG_IP, "IP: queue_expire: fragment queue 0x%X timed out!\n", qp));
  10042. +
  10043.         /*
  10044.          *    Send an ICMP "Fragment Reassembly Timeout" message. 
  10045.          */
  10046. @@ -1063,7 +988,6 @@
  10047.           i = prev->end - offset;
  10048.           offset += i;    /* ptr into datagram */
  10049.           ptr += i;    /* ptr into fragment data */
  10050. -         DPRINTF((DBG_IP, "IP: defrag: fixed low overlap %d bytes\n", i));
  10051.         }    
  10052.   
  10053.         /*
  10054. @@ -1088,8 +1012,6 @@
  10055.            */
  10056.           if (next->len <= 0) 
  10057.           {
  10058. -             DPRINTF((DBG_IP, "IP: defrag: removing frag 0x%X (len %d)\n",
  10059. -                             next, next->len));
  10060.               if (next->prev != NULL) 
  10061.                   next->prev->next = next->next;
  10062.                 else 
  10063. @@ -1101,7 +1023,6 @@
  10064.              kfree_skb(next->skb,FREE_READ);             
  10065.               kfree_s(next, sizeof(struct ipfrag));
  10066.           }
  10067. -         DPRINTF((DBG_IP, "IP: defrag: fixed high overlap %d bytes\n", i));
  10068.         }
  10069.   
  10070.         /* 
  10071. @@ -1188,22 +1109,12 @@
  10072.         mtu = (dev->mtu - hlen);        /* Size of data space */
  10073.         ptr = (raw + hlen);            /* Where to start from */
  10074.       
  10075. -       DPRINTF((DBG_IP, "IP: Fragmentation Desired\n"));
  10076. -       DPRINTF((DBG_IP, "    DEV=%s, MTU=%d, LEN=%d SRC=%s",
  10077. -         dev->name, dev->mtu, left, in_ntoa(iph->saddr)));
  10078. -       DPRINTF((DBG_IP, " DST=%s\n", in_ntoa(iph->daddr)));
  10079.         /*
  10080.          *    Check for any "DF" flag. [DF means do not fragment]
  10081.          */
  10082.          
  10083.         if (ntohs(iph->frag_off) & IP_DF) 
  10084.         {
  10085. -         DPRINTF((DBG_IP, "IP: Fragmentation Desired, but DF set !\n"));
  10086. -         DPRINTF((DBG_IP, "    DEV=%s, MTU=%d, LEN=%d SRC=%s",
  10087. -             dev->name, dev->mtu, left, in_ntoa(iph->saddr)));
  10088. -         DPRINTF((DBG_IP, " DST=%s\n", in_ntoa(iph->daddr)));
  10089.           ip_statistics.IpFragFails++;
  10090.           icmp_send(skb,ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, dev); 
  10091.           return;
  10092. @@ -1255,9 +1166,6 @@
  10093.              len/=8;
  10094.              len*=8;
  10095.          }
  10096. -         DPRINTF((DBG_IP,"IP: frag: creating fragment of %d bytes (%d total)\n",
  10097. -                             len, len + hlen));
  10098.           /*
  10099.            *    Allocate buffer. 
  10100.            */
  10101. @@ -1277,7 +1185,7 @@
  10102.           skb2->free = skb->free;
  10103.           skb2->len = len + hlen;
  10104.           skb2->h.raw=(char *) skb2->data;
  10105. +         skb2->raddr = skb->raddr;    /* For rebuild_header */
  10106.          /*
  10107.           *    Charge the memory for the fragment to any owner
  10108.           *    it might posess
  10109. @@ -1345,14 +1253,20 @@
  10110.      /*
  10111.       * Only forward packets that were fired at us when we are in promiscuous
  10112.       * mode. In standard mode we rely on the driver to filter for us.
  10113. +     *
  10114. +     * This is a mess. When the drivers class packets on the upcall this
  10115. +     * will tidy up!
  10116.       */
  10117.     
  10118.      if(dev->flags&IFF_PROMISC)
  10119.      {
  10120. -          if(memcmp((char *)&skb[1],dev->dev_addr,dev->addr_len))
  10121. +          if(memcmp(skb->data,dev->dev_addr,dev->addr_len))
  10122.                return;
  10123.      }
  10124.      
  10125. +    if(memcmp(skb->data,dev->broadcast, dev->addr_len))
  10126. +        return;
  10127. +    
  10128.  
  10129.    
  10130.        /*
  10131. @@ -1370,10 +1284,6 @@
  10132.      iph->ttl--;
  10133.      if (iph->ttl <= 0) 
  10134.      {
  10135. -        DPRINTF((DBG_IP, "\nIP: *** datagram expired: TTL=0 (ignored) ***\n"));
  10136. -        DPRINTF((DBG_IP, "    SRC = %s   ", in_ntoa(iph->saddr)));
  10137. -        DPRINTF((DBG_IP, "    DST = %s (ignored)\n", in_ntoa(iph->daddr)));
  10138. -    
  10139.          /* Tell the sender its packet died... */
  10140.          icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, dev);
  10141.          return;
  10142. @@ -1395,8 +1305,6 @@
  10143.      rt = ip_rt_route(iph->daddr, NULL, NULL);
  10144.      if (rt == NULL) 
  10145.      {
  10146. -        DPRINTF((DBG_IP, "\nIP: *** routing (phase I) failed ***\n"));
  10147. -
  10148.          /*
  10149.           *    Tell the sender its packet cannot be delivered. Again
  10150.           *    ICMP is screened later.
  10151. @@ -1425,8 +1333,6 @@
  10152.          rt = ip_rt_route(raddr, NULL, NULL);
  10153.          if (rt == NULL) 
  10154.          {
  10155. -            DPRINTF((DBG_IP, "\nIP: *** routing (phase II) failed ***\n"));
  10156. -
  10157.              /* 
  10158.               *    Tell the sender its packet cannot be delivered... 
  10159.               */
  10160. @@ -1460,10 +1366,6 @@
  10161.       * If the indicated interface is up and running, kick it.
  10162.       */
  10163.  
  10164. -    DPRINTF((DBG_IP, "\nIP: *** fwd %s -> ", in_ntoa(iph->saddr)));
  10165. -    DPRINTF((DBG_IP, "%s (via %s), LEN=%d\n",
  10166. -            in_ntoa(raddr), dev2->name, skb->len));
  10167. -
  10168.      if (dev2->flags & IFF_UP) 
  10169.      {
  10170.      
  10171. @@ -1548,8 +1450,6 @@
  10172.  
  10173.      ip_statistics.IpInReceives++;
  10174.      
  10175. -    DPRINTF((DBG_IP, "<<\n"));
  10176. -    
  10177.      /*
  10178.       *    Tag the ip header of this packet so we can find it
  10179.       */
  10180. @@ -1568,9 +1468,6 @@
  10181.        if (skb->len<sizeof(struct iphdr) || iph->ihl<5 || iph->version != 4 || ip_fast_csum((unsigned char *)iph, iph->ihl) !=0) 
  10182.        {
  10183.            ip_statistics.IpInHdrErrors++;
  10184. -        DPRINTF((DBG_IP, "\nIP: *** datagram error ***\n"));
  10185. -        DPRINTF((DBG_IP, "    SRC = %s   ", in_ntoa(iph->saddr)));
  10186. -        DPRINTF((DBG_IP, "    DST = %s (ignored)\n", in_ntoa(iph->daddr)));
  10187.          kfree_skb(skb, FREE_WRITE);
  10188.          return(0);
  10189.      }
  10190. @@ -1589,7 +1486,6 @@
  10191.         
  10192.      if (iph->ihl != 5) 
  10193.      {      /* Fast path for the typical optionless IP packet. */
  10194. -              ip_print(iph);        /* Bogus, only for debugging. */
  10195.                memset((char *) &opt, 0, sizeof(opt));
  10196.                if (do_options(iph, &opt) != 0)
  10197.                return 0;
  10198. @@ -1628,7 +1524,7 @@
  10199.  #ifdef CONFIG_IP_FORWARD
  10200.          ip_forward(skb, dev, is_frag);
  10201.  #else
  10202. -        printk("Machine %x tried to use us as a forwarder to %x but we have forwarding disabled!\n",
  10203. +        printk("Machine %lx tried to use us as a forwarder to %lx but we have forwarding disabled!\n",
  10204.              iph->saddr,iph->daddr);
  10205.          ip_statistics.IpInAddrErrors++;
  10206.  #endif            
  10207. @@ -1647,20 +1543,11 @@
  10208.  
  10209.        if(is_frag)
  10210.        {
  10211. -#ifdef CONFIG_IP_DEFRAG
  10212.          /* Defragment. Obtain the complete packet if there is one */
  10213.          skb=ip_defrag(iph,skb,dev);
  10214.              if(skb==NULL)
  10215.                  return 0;
  10216.              iph=skb->h.iph;
  10217. -#else
  10218. -        printk("\nIP: *** datagram fragmentation not yet implemented ***\n");
  10219. -        printk("    SRC = %s   ", in_ntoa(iph->saddr));
  10220. -        printk("    DST = %s (ignored)\n", in_ntoa(iph->daddr));
  10221. -        icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PROT_UNREACH, dev);
  10222. -        kfree_skb(skb, FREE_WRITE);
  10223. -        return(0);
  10224. -#endif
  10225.      }
  10226.  
  10227.      /*
  10228. @@ -1681,9 +1568,6 @@
  10229.  
  10230.                 if (ipprot->protocol != iph->protocol) 
  10231.                     continue;
  10232. -        DPRINTF((DBG_IP, "Using protocol = %X:\n", ipprot));
  10233. -        print_ipprot(ipprot);
  10234. -
  10235.         /*
  10236.      *     See if we need to make a copy of it.  This will
  10237.      *     only be set if more than one protocol wants it. 
  10238. @@ -1786,8 +1670,6 @@
  10239.        skb->dev = dev;
  10240.        skb->when = jiffies;
  10241.    
  10242. -    DPRINTF((DBG_IP, ">>\n"));
  10243. -
  10244.      /*
  10245.       *    Find the IP header and set the length. This is bad
  10246.       *    but once we get the skb data handling code in the
  10247. @@ -1825,7 +1707,6 @@
  10248.      /*
  10249.       *    Print the frame when debugging
  10250.       */
  10251. -    ip_print(iph);
  10252.  
  10253.      /*
  10254.       *    More debugging. You cannot queue a packet already on a list
  10255. Only in linux.old/net/inet: ip.c.orig
  10256. Only in linux.old/net/inet: ip.h.orig
  10257. diff -u --new-file --recursive linux.old/net/inet/ipx.c linux/net/inet/ipx.c
  10258. --- linux.old/net/inet/ipx.c    Fri May 20 18:43:15 1994
  10259. +++ linux/net/inet/ipx.c    Fri May 20 18:50:43 1994
  10260. @@ -22,6 +22,10 @@
  10261.   *                 Adding a route will overwrite any existing route to the same
  10262.   *            network.
  10263.   *    Revision 0.24:    Supports new /proc with no 4K limit
  10264. + *    Revision 0.25:    Add ephemeral sockets, passive local network 
  10265. + *            identification, support for local net 0 and
  10266. + *            multiple datalinks
  10267. + *            
  10268.   *
  10269.   */
  10270.   
  10271. @@ -46,6 +50,7 @@
  10272.  #include <linux/fcntl.h>
  10273.  #include <linux/mm.h>
  10274.  #include <linux/interrupt.h>
  10275. +#include "p8022.h"
  10276.  
  10277.  #ifdef CONFIG_IPX
  10278.  /***********************************************************************************************************************\
  10279. @@ -184,7 +189,40 @@
  10280.  \*******************************************************************************************************************/
  10281.  
  10282.  
  10283. +static struct datalink_proto    *p8022_datalink = NULL;
  10284. +static struct datalink_proto    *pEII_datalink = NULL;
  10285. +static struct datalink_proto    *p8023_datalink = NULL;
  10286. +static struct datalink_proto    *pSNAP_datalink = NULL;
  10287. +
  10288.  static ipx_route *ipx_router_list=NULL;
  10289. +static ipx_route *ipx_localnet_list=NULL;
  10290. +
  10291. +static ipx_route *
  10292. +ipxrtr_get_local_net(struct device *dev, unsigned short datalink)
  10293. +{
  10294. +    ipx_route *r;
  10295. +    unsigned long flags;
  10296. +    save_flags(flags);
  10297. +    cli();
  10298. +    r=ipx_localnet_list;
  10299. +    while(r!=NULL)
  10300. +    {
  10301. +        if((r->dev==dev) && (r->dlink_type == datalink))
  10302. +        {
  10303. +            restore_flags(flags);
  10304. +            return r;
  10305. +        }
  10306. +        r=r->next;
  10307. +    }
  10308. +    restore_flags(flags);
  10309. +    return NULL;
  10310. +}
  10311. +    
  10312. +static ipx_route *
  10313. +ipxrtr_get_default_net(void)
  10314. +{
  10315. +    return ipx_localnet_list;
  10316. +}
  10317.  
  10318.  static ipx_route *ipxrtr_get_dev(long net)
  10319.  {
  10320. @@ -206,10 +244,55 @@
  10321.      return NULL;
  10322.  }
  10323.  
  10324. +static void ipxrtr_add_localnet(ipx_route *newnet)
  10325. +{
  10326. +    ipx_route *r;
  10327. +    unsigned long flags;
  10328. +    save_flags(flags);
  10329. +    cli();
  10330. +
  10331. +    newnet->nextlocal = NULL;
  10332. +    if (ipx_localnet_list == NULL) {
  10333. +        ipx_localnet_list = newnet;
  10334. +        restore_flags(flags);
  10335. +        return;
  10336. +    }
  10337. +
  10338. +    r=ipx_localnet_list;
  10339. +    while(r->nextlocal!=NULL)
  10340. +        r=r->nextlocal;
  10341. +
  10342. +    r->nextlocal = newnet;
  10343. +    
  10344. +    restore_flags(flags);
  10345. +    return;
  10346. +}
  10347. +
  10348.  static int ipxrtr_create(struct ipx_route_def *r)
  10349.  {
  10350.      ipx_route *rt=ipxrtr_get_dev(r->ipx_network);
  10351.      struct device *dev;
  10352. +    unsigned short    dlink_type;
  10353. +    struct datalink_proto *datalink = NULL;
  10354. +
  10355. +    if (r->ipx_flags & IPX_RT_BLUEBOOK) {
  10356. +        dlink_type = htons(ETH_P_IPX);
  10357. +        datalink = pEII_datalink;
  10358. +    } else if (r->ipx_flags & IPX_RT_8022) {
  10359. +        dlink_type = htons(ETH_P_802_2);
  10360. +        datalink = p8022_datalink;
  10361. +    } else if (r->ipx_flags & IPX_RT_SNAP) {
  10362. +        dlink_type = htons(ETH_P_SNAP);
  10363. +        datalink = pSNAP_datalink;
  10364. +    } else {
  10365. +        dlink_type = htons(ETH_P_802_3);
  10366. +        datalink = p8023_datalink;
  10367. +    }
  10368. +
  10369. +    if (datalink == NULL) {
  10370. +        printk("IPX: Unsupported datalink protocol.\n");
  10371. +        return -EPROTONOSUPPORT;
  10372. +    }
  10373.  
  10374.      if(r->ipx_router_network!=0)
  10375.      {
  10376. @@ -230,7 +313,9 @@
  10377.          rt->net=r->ipx_network;
  10378.          rt->router_net=r->ipx_router_network;
  10379.          memcpy(rt->router_node,r->ipx_router_node,sizeof(rt->router_node));
  10380. -        rt->flags=(rt1->flags&IPX_RT_BLUEBOOK)|IPX_RT_ROUTED;
  10381. +        rt->flags=IPX_RT_ROUTED;
  10382. +        rt->dlink_type = dlink_type;
  10383. +        rt->datalink = datalink;
  10384.          rt->dev=rt1->dev;
  10385.          return 0;
  10386.      }
  10387. @@ -243,29 +328,53 @@
  10388.          return -EINVAL;
  10389.      if(dev->addr_len<2)
  10390.          return -EINVAL;
  10391. +    if (ipxrtr_get_local_net(dev, dlink_type) != NULL)
  10392. +        return -EEXIST;
  10393.      /* Ok now create */
  10394. -    if (rt==NULL)
  10395. -    {
  10396. -        rt=(ipx_route *)kmalloc(sizeof(ipx_route),GFP_ATOMIC);    /* Because we are brave and don't lock the table! */
  10397. -        if(rt==NULL)
  10398. -            return -EAGAIN;
  10399. -        rt->next=ipx_router_list;
  10400. -        ipx_router_list=rt;
  10401. -    }
  10402. +    rt=(ipx_route *)kmalloc(sizeof(ipx_route),GFP_ATOMIC);    /* Because we are brave and don't lock the table! */
  10403. +    if(rt==NULL)
  10404. +        return -EAGAIN;
  10405. +    rt->next=ipx_router_list;
  10406. +    ipx_router_list=rt;
  10407.      rt->router_net=0;
  10408.      memset(rt->router_node,0,sizeof(rt->router_node));
  10409.      rt->dev=dev;
  10410.      rt->net=r->ipx_network;
  10411. -    rt->flags=r->ipx_flags&IPX_RT_BLUEBOOK;
  10412. +    rt->flags=0;
  10413. +    rt->dlink_type = dlink_type;
  10414. +    rt->datalink = datalink;
  10415. +    ipxrtr_add_localnet(rt);
  10416.      return 0;
  10417.  }
  10418.  
  10419. +
  10420. +static int ipxrtr_delete_localnet(ipx_route *d)
  10421. +{
  10422. +    ipx_route *r=ipx_localnet_list;
  10423. +    if(r==d)
  10424. +    {
  10425. +        ipx_localnet_list=r->next;
  10426. +        return 0;
  10427. +    }
  10428. +    while(r->next!=NULL)
  10429. +    {
  10430. +        if(r->nextlocal==d)
  10431. +        {
  10432. +            r->nextlocal=d->nextlocal;
  10433. +            return 0;
  10434. +        }
  10435. +        r=r->nextlocal;
  10436. +    }
  10437. +    return -ENOENT;
  10438. +}
  10439. +
  10440.  static int ipxrtr_delete(long net)
  10441.  {
  10442.      ipx_route *r=ipx_router_list;
  10443.      if(r->net==net)
  10444.      {
  10445.          ipx_router_list=r->next;
  10446. +        kfree_s(r,sizeof(ipx_route));
  10447.          return 0;
  10448.      }
  10449.      while(r->next!=NULL)
  10450. @@ -274,6 +383,9 @@
  10451.          {
  10452.              ipx_route *d=r->next;
  10453.              r->next=d->next;
  10454. +            if (d->router_net == 0) {
  10455. +                ipxrtr_delete_localnet(d);
  10456. +            }
  10457.              kfree_s(d,sizeof(ipx_route));
  10458.              return 0;
  10459.          }
  10460. @@ -479,8 +591,6 @@
  10461.              kfree_s((void *)sk,sizeof(*sk));
  10462.              return(-ESOCKTNOSUPPORT);
  10463.      }
  10464. -    sk->stamp.tv_sec=0;
  10465. -    sk->rmem_alloc=0;
  10466.      sk->dead=0;
  10467.      sk->next=NULL;
  10468.      sk->broadcast=0;
  10469. @@ -489,7 +599,7 @@
  10470.      sk->wmem_alloc=0;
  10471.      sk->rmem_alloc=0;
  10472.      sk->inuse=0;
  10473. -    sk->dead=0;
  10474. +    sk->shutdown=0;
  10475.      sk->prot=NULL;    /* So we use default free mechanisms */
  10476.      sk->broadcast=0;
  10477.      sk->err=0;
  10478. @@ -497,13 +607,11 @@
  10479.      skb_queue_head_init(&sk->write_queue);
  10480.      sk->send_head=NULL;
  10481.      skb_queue_head_init(&sk->back_log);
  10482. -    sk->mtu=512;
  10483.      sk->state=TCP_CLOSE;
  10484.      sk->socket=sock;
  10485.      sk->type=sock->type;
  10486.      sk->ipx_type=0;        /* General user level IPX */
  10487.      sk->debug=0;
  10488. -    sk->localroute=0;
  10489.      
  10490.      memset(&sk->ipx_dest_addr,'\0',sizeof(sk->ipx_dest_addr));
  10491.      memset(&sk->ipx_source_addr,'\0',sizeof(sk->ipx_source_addr));
  10492. @@ -542,12 +650,30 @@
  10493.      return(0);
  10494.  }
  10495.          
  10496. +static unsigned short first_free_socketnum(void)
  10497. +{
  10498. +    static unsigned short    socketNum = 0x4000;
  10499. +    unsigned short    startNum, foundNum = 0;
  10500. +
  10501. +    startNum = socketNum;
  10502. +    do {
  10503. +        if (ipx_find_socket(htons(socketNum)) == NULL) {
  10504. +            foundNum = socketNum;
  10505. +        }
  10506. +        socketNum++;
  10507. +        if (socketNum > 0x7ffc) socketNum = 0x4000;
  10508. +    }    while (!foundNum && (socketNum != startNum));
  10509. +
  10510. +    return    htons(foundNum);
  10511. +}
  10512. +    
  10513.  static int ipx_bind(struct socket *sock, struct sockaddr *uaddr,int addr_len)
  10514.  {
  10515.      ipx_socket *sk;
  10516.      int err;
  10517.      struct sockaddr_ipx addr;
  10518.      struct ipx_route *rt;
  10519. +    unsigned char    *nodestart;
  10520.      
  10521.      sk=(ipx_socket *)sock->data;
  10522.      if(sk==NULL)
  10523. @@ -555,7 +681,7 @@
  10524.          printk("IPX:bind:sock->data=NULL\n");
  10525.          return 0;
  10526.      }
  10527. -
  10528. +    
  10529.      if(sk->zapped==0)
  10530.          return(-EIO);
  10531.          
  10532. @@ -566,6 +692,11 @@
  10533.          return -EINVAL;
  10534.      memcpy_fromfs(&addr,uaddr,addr_len);
  10535.      
  10536. +    if (addr.sipx_port == 0) {
  10537. +        addr.sipx_port = first_free_socketnum();
  10538. +        if (addr.sipx_port == 0) return -EINVAL;
  10539. +    }
  10540. +        
  10541.      if(ntohs(addr.sipx_port)<0x4000 && !suser())
  10542.          return(-EPERM);    /* protect IPX system stuff like routing/sap */
  10543.      
  10544. @@ -577,20 +708,32 @@
  10545.          if(sk->debug)
  10546.              printk("IPX: bind failed because port %X in use.\n",
  10547.                  (int)addr.sipx_port);
  10548. -        return(-EADDRINUSE);       
  10549. +        return -EADDRINUSE;       
  10550.      }
  10551. +
  10552.      sk->ipx_source_addr.sock=addr.sipx_port;
  10553. -    memcpy(sk->ipx_source_addr.node,addr.sipx_node,sizeof(sk->ipx_source_addr.node));
  10554. -    sk->ipx_source_addr.net=addr.sipx_network;
  10555. -    if((rt=ipxrtr_get_dev(sk->ipx_source_addr.net))==NULL)
  10556. +
  10557. +    if (addr.sipx_network == 0L) {
  10558. +        rt = ipxrtr_get_default_net();
  10559. +    } else {
  10560. +        rt = ipxrtr_get_dev(addr.sipx_network);
  10561. +    }
  10562. +
  10563. +    if(rt == NULL)
  10564.      {
  10565.          if(sk->debug)
  10566.              printk("IPX: bind failed (no device for net %lX)\n",
  10567.                  sk->ipx_source_addr.net);
  10568. -        return(-EADDRNOTAVAIL);
  10569. +        return -EADDRNOTAVAIL;
  10570.      }
  10571. +
  10572. +    sk->ipx_source_addr.net=rt->net;
  10573. +
  10574. +    /* IPX addresses zero pad physical addresses less than 6 */
  10575.      memset(sk->ipx_source_addr.node,'\0',6);
  10576. -    memcpy(sk->ipx_source_addr.node,rt->dev->dev_addr,rt->dev->addr_len);
  10577. +    nodestart = sk->ipx_source_addr.node + (6 - rt->dev->addr_len);
  10578. +    memcpy(nodestart,rt->dev->dev_addr,rt->dev->addr_len);
  10579. +
  10580.      ipx_insert_socket(sk);
  10581.      sk->zapped=0;
  10582.      if(sk->debug)
  10583. @@ -621,8 +764,6 @@
  10584.          return err;
  10585.      memcpy_fromfs(&addr,uaddr,sizeof(addr));
  10586.      
  10587. -    if(ntohs(addr.sipx_port)<0x4000 && !suser())
  10588. -        return -EPERM;
  10589.      if(sk->ipx_source_addr.net==0)    /* Must bind first - no autobinding in this */
  10590.          return -EINVAL;
  10591.          
  10592. @@ -691,18 +832,16 @@
  10593.      return(0);
  10594.  }
  10595.  
  10596. -
  10597.  int ipx_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
  10598.  {
  10599.      /* NULL here for pt means the packet was looped back */
  10600.      ipx_socket *sock;
  10601. -    unsigned char *buff;
  10602.      ipx_packet *ipx;
  10603.      ipx_route *rt;
  10604. +    ipx_route *ln;
  10605. +    unsigned char IPXaddr[6];
  10606.      
  10607. -    buff=skb->data;
  10608. -    buff+=dev->hard_header_len;
  10609. -    ipx=(ipx_packet *)buff;
  10610. +    ipx=(ipx_packet *)skb->h.raw;
  10611.      
  10612.      if(ipx->ipx_checksum!=IPX_NO_CHECKSUM)
  10613.      {
  10614. @@ -714,7 +853,7 @@
  10615.      }
  10616.      
  10617.      /* Too small */
  10618. -    if(htons(ipx->ipx_pktsize)<sizeof(ipx_packet)+dev->hard_header_len)
  10619. +    if(htons(ipx->ipx_pktsize)<sizeof(ipx_packet))
  10620.      {
  10621.          kfree_skb(skb,FREE_READ);
  10622.          return(0);
  10623. @@ -727,9 +866,20 @@
  10624.          return(0);
  10625.      }
  10626.      
  10627. +    /* Determine what local ipx endpoint this is */
  10628. +    ln = ipxrtr_get_local_net(dev, pt->type);
  10629. +    if (ln == NULL) 
  10630. +    {
  10631. +        kfree_skb(skb,FREE_READ);
  10632. +        return(0);
  10633. +    }
  10634. +
  10635. +    memset(IPXaddr, '\0', 6);
  10636. +    memcpy(IPXaddr+(6 - dev->addr_len), dev->dev_addr, dev->addr_len);
  10637. +
  10638.      /* Not us/broadcast */
  10639. -    if(memcmp(dev->dev_addr,ipx->ipx_dest.node,dev->addr_len)!=0
  10640. -         && memcmp(ipx_broadcast_node,ipx->ipx_dest.node,dev->addr_len)!=0)
  10641. +    if(memcmp(IPXaddr,ipx->ipx_dest.node,6)!=0
  10642. +         && memcmp(ipx_broadcast_node,ipx->ipx_dest.node,6)!=0)
  10643.      {
  10644.          /**********************************************************************************************
  10645.          
  10646. @@ -739,6 +889,8 @@
  10647.              
  10648.          ***********************************************************************************************/
  10649.          
  10650. +        int incoming_size;
  10651. +        int outgoing_size;
  10652.          struct sk_buff *skb2;
  10653.          int free_it=0;
  10654.          
  10655. @@ -749,6 +901,7 @@
  10656.              return(0);
  10657.          }
  10658.  
  10659. +        ipx->ipx_tctrl++;
  10660.          /* Don't forward if we don't have a route. We ought to go off and start hunting out routes but
  10661.             if someone needs this _THEY_ can add it */        
  10662.          rt=ipxrtr_get_dev(ipx->ipx_dest.net);
  10663. @@ -757,11 +910,16 @@
  10664.              kfree_skb(skb,FREE_READ);
  10665.              return(0);
  10666.          }
  10667. -        if(rt->dev->hard_header_len!=dev->hard_header_len)
  10668. +
  10669. +        /* Check for differences in outgoing and incoming packet size */
  10670. +        incoming_size = skb->len - ntohs(ipx->ipx_pktsize);
  10671. +        outgoing_size = rt->datalink->header_length + rt->dev->hard_header_len;
  10672. +        if(incoming_size != outgoing_size)
  10673.          {
  10674.              /* A different header length causes a copy. Awkward to avoid with the current
  10675.                 sk_buff stuff. */
  10676. -            skb2=alloc_skb(skb->len,GFP_ATOMIC);
  10677. +            skb2=alloc_skb(ntohs(ipx->ipx_pktsize) + outgoing_size,
  10678. +                    GFP_ATOMIC);
  10679.              if(skb2==NULL)
  10680.              {
  10681.                  kfree_skb(skb,FREE_READ);
  10682. @@ -769,30 +927,31 @@
  10683.              }
  10684.              free_it=1;
  10685.              skb2->free=1;
  10686. -            skb2->len=skb->len;
  10687. -            memcpy((char *)(skb2+1),(char *)(skb+1),skb->len);
  10688. -            buff=(char *)(skb2+1);
  10689. -            ipx=(ipx_packet *)(buff+dev->hard_header_len);
  10690. +            skb2->len=ntohs(ipx->ipx_pktsize) + outgoing_size;
  10691. +            skb2->mem_addr = skb2;
  10692. +            skb2->arp = 1;
  10693. +            skb2->sk = NULL;
  10694. +
  10695. +            /* Need to copy with appropriate offsets */
  10696. +            memcpy((char *)(skb2+1)+outgoing_size,
  10697. +                (char *)(skb+1)+incoming_size,
  10698. +                ntohs(ipx->ipx_pktsize));
  10699.          }
  10700.          else
  10701.          {
  10702.              skb2=skb;
  10703. -            buff=(char *)(skb+1);
  10704.          }
  10705. +
  10706.          /* Now operate on the buffer */
  10707.          /* Increase hop count */
  10708. -        ipx->ipx_tctrl++;
  10709. -        /* If the route is a gateway then forward to it */
  10710.          
  10711. -        dev->hard_header(buff, dev, 
  10712. -            (rt->flags&IPX_RT_BLUEBOOK)?ntohs(ETH_P_IPX):ntohs(skb2->len),
  10713. -            (rt->flags&IPX_RT_ROUTED)?rt->router_node:ipx->ipx_dest.node,
  10714. -            NULL,    /* Our source */
  10715. -            skb2->len,
  10716. -            skb2);
  10717. -            
  10718. -        dev_queue_xmit(skb2,dev,SOPRI_NORMAL);
  10719. +        skb2->dev = rt->dev;
  10720. +        rt->datalink->datalink_header(rt->datalink, skb2, 
  10721. +            (rt->flags&IPX_RT_ROUTED)?rt->router_node
  10722. +                        :ipx->ipx_dest.node);
  10723.  
  10724. +        dev_queue_xmit(skb2,rt->dev,SOPRI_NORMAL);
  10725. +
  10726.          if(free_it)
  10727.              kfree_skb(skb,FREE_READ);
  10728.          return(0);
  10729. @@ -800,13 +959,22 @@
  10730.      /************ End of router: Now sanity check stuff for us ***************/
  10731.      
  10732.      /* Ok its for us ! */
  10733. -    
  10734. +    if (ln->net == 0L) {
  10735. +        printk("IPX: Registering local net %lx\n", ipx->ipx_dest.net);
  10736. +        ln->net = ipx->ipx_dest.net;
  10737. +    }
  10738. +
  10739.      sock=ipx_find_socket(ipx->ipx_dest.sock);
  10740.      if(sock==NULL)    /* But not one of our sockets */
  10741.      {
  10742.          kfree_skb(skb,FREE_READ);
  10743.          return(0);
  10744.      }
  10745. +
  10746. +    /* Check to see if this socket needs its network number */
  10747. +    ln = ipxrtr_get_default_net();
  10748. +    if (sock->ipx_source_addr.net == 0L)
  10749. +        sock->ipx_source_addr.net = ln->net;
  10750.      
  10751.      if(sock->rmem_alloc>=sock->rcvbuf)
  10752.      {
  10753. @@ -815,15 +983,14 @@
  10754.      }
  10755.      
  10756.      sock->rmem_alloc+=skb->mem_len;
  10757. +    skb->sk = sock;
  10758. +
  10759.      skb_queue_tail(&sock->receive_queue,skb);
  10760.      if(!sock->dead)
  10761.          sock->data_ready(sock,skb->len);
  10762.      return(0);
  10763.  }
  10764.  
  10765. -
  10766. -
  10767. -
  10768.  static int ipx_sendto(struct socket *sock, void *ubuf, int len, int noblock,
  10769.      unsigned flags, struct sockaddr *usip, int addr_len)
  10770.  {
  10771. @@ -836,8 +1003,12 @@
  10772.      struct ipx_packet *ipx;
  10773.      int size;
  10774.      ipx_route *rt;
  10775. +    struct datalink_proto *dl = NULL;
  10776. +    unsigned char IPXaddr[6];
  10777. +    int self_addressing = 0;
  10778. +    int broadcast = 0;
  10779.  
  10780. -    if(flags&~MSG_DONTROUTE)
  10781. +    if(flags)
  10782.          return -EINVAL;
  10783.      if(len<0)
  10784.          return -EINVAL;
  10785. @@ -869,8 +1040,13 @@
  10786.      
  10787.      if(sk->debug)
  10788.          printk("IPX: sendto: Addresses built.\n");
  10789. -    if(!sk->broadcast && memcmp(&sipx.sipx_node,&ipx_broadcast_node,6)==0)
  10790. -        return -ENETUNREACH;
  10791. +
  10792. +    if(memcmp(&sipx.sipx_node,&ipx_broadcast_node,6)==0) {
  10793. +        if (!sk->broadcast)
  10794. +            return -ENETUNREACH;
  10795. +        broadcast = 1;
  10796. +    }
  10797. +
  10798.      /* Build a packet */
  10799.      
  10800.      if(sk->debug)
  10801. @@ -882,57 +1058,70 @@
  10802.      size=sizeof(ipx_packet)+len;    /* For mac headers */
  10803.  
  10804.      /* Find out where this has to go */
  10805. -    rt=ipxrtr_get_dev(sipx.sipx_network);
  10806. -    /* No suitable route - no gateways when not routing */
  10807. -    if(rt==NULL || ((flags&IPX_RT_ROUTED)&& ((flags&MSG_DONTROUTE)||sk->localroute)))
  10808. +    if (sipx.sipx_network == 0L) {
  10809. +        rt = ipxrtr_get_default_net();
  10810. +        if (rt != NULL)
  10811. +            sipx.sipx_network = rt->net;
  10812. +    } else
  10813. +        rt=ipxrtr_get_dev(sipx.sipx_network);
  10814. +
  10815. +    if(rt==NULL)
  10816.      {
  10817.          return -ENETUNREACH;
  10818.      }
  10819.      
  10820.      dev=rt->dev;
  10821. +    dl = rt->datalink;
  10822.      
  10823. -    size+=dev->hard_header_len;
  10824. -        
  10825. +    size += dev->hard_header_len;
  10826. +    size += dl->header_length;
  10827. +
  10828.      if(sk->debug)
  10829. -        printk("IPX: sendto: allocating buffer (%d)\n",size-sizeof(struct sk_buff));
  10830. +        printk("IPX: sendto: allocating buffer (%d)\n",size);
  10831.      
  10832. -    if(size+sk->wmem_alloc>sk->sndbuf)
  10833. +    if(size+sk->wmem_alloc>sk->sndbuf) {
  10834.          return -EAGAIN;
  10835. +    }
  10836.          
  10837.      skb=alloc_skb(size,GFP_KERNEL);
  10838.      if(skb==NULL)
  10839.          return -ENOMEM;
  10840. -    if(skb->mem_len+sk->wmem_alloc>sk->sndbuf)
  10841. -    {
  10842. -        kfree_skb(skb,FREE_WRITE);
  10843. -        return -EAGAIN;
  10844. -    }
  10845. -
  10846. -    sk->wmem_alloc+=skb->mem_len;
  10847. +        
  10848. +    skb->mem_addr=skb;
  10849.      skb->sk=sk;
  10850.      skb->free=1;
  10851.      skb->arp=1;
  10852. -    skb->len=size-sizeof(struct sk_buff);
  10853. +    skb->len=size;
  10854. +
  10855. +    sk->wmem_alloc+=skb->mem_len;
  10856.  
  10857.      if(sk->debug)
  10858.          printk("Building MAC header.\n");        
  10859.      skb->dev=rt->dev;
  10860.      
  10861. -    dev->hard_header(skb->data,skb->dev,
  10862. -        (rt->flags&IPX_RT_BLUEBOOK)?ETH_P_IPX:ETH_P_802_3),
  10863. -        (rt->flags&IPX_RT_ROUTED)?rt->router_node:sipx.sipx_node,
  10864. -        NULL,
  10865. -        len+sizeof(ipx_packet),
  10866. -        skb);
  10867. +    /* Build Data Link header */
  10868. +    dl->datalink_header(dl, skb, 
  10869. +        (rt->flags&IPX_RT_ROUTED)?rt->router_node:sipx.sipx_node);
  10870. +
  10871. +    /* See if we are sending to ourself */
  10872. +    memset(IPXaddr, '\0', 6);
  10873. +    memcpy(IPXaddr+(6 - skb->dev->addr_len), skb->dev->dev_addr, 
  10874. +            skb->dev->addr_len);
  10875. +
  10876. +    self_addressing = !memcmp(IPXaddr, 
  10877. +                (rt->flags&IPX_RT_ROUTED)?rt->router_node
  10878. +                :sipx.sipx_node,
  10879. +                6);
  10880.  
  10881.      /* Now the IPX */
  10882.      if(sk->debug)
  10883.          printk("Building IPX Header.\n");
  10884. -    ipx=(ipx_packet *)skb->data+skb->dev->hard_header_len;
  10885. +    ipx=(ipx_packet *)skb->h.raw;
  10886.      ipx->ipx_checksum=0xFFFF;
  10887.      ipx->ipx_pktsize=htons(len+sizeof(ipx_packet));
  10888.      ipx->ipx_tctrl=0;
  10889. -    ipx->ipx_type=sk->ipx_type;
  10890. +    ipx->ipx_type=sipx.sipx_type;
  10891. +
  10892.      memcpy(&ipx->ipx_source,&sk->ipx_source_addr,sizeof(ipx->ipx_source));
  10893.      ipx->ipx_dest.net=sipx.sipx_network;
  10894.      memcpy(ipx->ipx_dest.node,sipx.sipx_node,sizeof(ipx->ipx_dest.node));
  10895. @@ -943,11 +1132,35 @@
  10896.      memcpy_fromfs((char *)(ipx+1),ubuf,len);
  10897.      if(sk->debug)
  10898.          printk("IPX: Transmitting buffer\n");
  10899. -    if(dev->flags&IFF_LOOPBACK)
  10900. +    if((dev->flags&IFF_LOOPBACK) || self_addressing) {
  10901. +        struct packet_type    pt;
  10902. +
  10903.          /* loop back */
  10904. -        ipx_rcv(skb,dev,NULL);
  10905. -    else
  10906. +        pt.type = rt->dlink_type;
  10907. +        sk->wmem_alloc-=skb->mem_len;
  10908. +        skb->sk = NULL;
  10909. +        ipx_rcv(skb,dev,&pt);
  10910. +    } else {
  10911. +        if (broadcast) {
  10912. +            struct packet_type    pt;
  10913. +            struct sk_buff        *skb2;
  10914. +
  10915. +            /* loop back */
  10916. +            pt.type = rt->dlink_type;
  10917. +            
  10918. +            skb2=alloc_skb(skb->len, GFP_ATOMIC);
  10919. +            skb2->mem_addr=skb2;
  10920. +            skb2->free=1;
  10921. +            skb2->arp=1;
  10922. +            skb2->len=skb->len;
  10923. +            skb2->sk = NULL;
  10924. +            skb2->h.raw = skb2->data + rt->datalink->header_length
  10925. +                + dev->hard_header_len;
  10926. +            memcpy(skb2->data, skb->data, skb->len);
  10927. +            ipx_rcv(skb2,dev,&pt);
  10928. +        }
  10929.          dev_queue_xmit(skb,dev,SOPRI_NORMAL);
  10930. +    }
  10931.      return len;
  10932.  }
  10933.  
  10934. @@ -956,21 +1169,17 @@
  10935.      return ipx_sendto(sock,ubuf,size,noblock,flags,NULL,0);
  10936.  }
  10937.  
  10938. -static int ipx_write(struct socket *sock, char *ubuf, int size, int noblock)
  10939. -{
  10940. -    return ipx_send(sock,ubuf,size,noblock,0);
  10941. -}
  10942. -
  10943.  static int ipx_recvfrom(struct socket *sock, void *ubuf, int size, int noblock,
  10944.             unsigned flags, struct sockaddr *sip, int *addr_len)
  10945.  {
  10946.      ipx_socket *sk=(ipx_socket *)sock->data;
  10947.      struct sockaddr_ipx *sipx=(struct sockaddr_ipx *)sip;
  10948. +    struct ipx_packet    *ipx = NULL;
  10949.      /* FILL ME IN */
  10950.      int copied = 0;
  10951.      struct sk_buff *skb;
  10952.      int er;
  10953. -
  10954. +    
  10955.      if(sk->err)
  10956.      {
  10957.          er= -sk->err;
  10958. @@ -1001,24 +1210,33 @@
  10959.      skb=skb_recv_datagram(sk,flags,noblock,&er);
  10960.      if(skb==NULL)
  10961.          return er;
  10962. -    copied=(size<skb->len)?size:skb->len;
  10963. +
  10964. +    ipx = (ipx_packet *)(skb->h.raw);
  10965. +    copied=ntohs(ipx->ipx_pktsize) - sizeof(ipx_packet);
  10966.      skb_copy_datagram(skb,sizeof(struct ipx_packet),ubuf,copied);
  10967. -    sk->stamp=skb->stamp;
  10968.      
  10969.      if(sipx)
  10970.      {
  10971.          struct sockaddr_ipx addr;
  10972.          
  10973.          addr.sipx_family=AF_IPX;
  10974. -        addr.sipx_port=((ipx_packet*)skb->h.raw)->ipx_source.sock;
  10975. -        memcpy(addr.sipx_node,((ipx_packet*)skb->h.raw)->ipx_source.node,sizeof(addr.sipx_node));
  10976. -        addr.sipx_network=((ipx_packet*)skb->h.raw)->ipx_source.net;
  10977. +        addr.sipx_port=ipx->ipx_source.sock;
  10978. +        memcpy(addr.sipx_node,ipx->ipx_source.node,sizeof(addr.sipx_node));
  10979. +        addr.sipx_network=ipx->ipx_source.net;
  10980. +        addr.sipx_type = ipx->ipx_type;
  10981.          memcpy_tofs(sipx,&addr,sizeof(*sipx));
  10982.      }
  10983.      skb_free_datagram(skb);
  10984.      return(copied);
  10985.  }        
  10986.  
  10987. +
  10988. +static int ipx_write(struct socket *sock, char *ubuf, int size, int noblock)
  10989. +{
  10990. +    return ipx_send(sock,ubuf,size,noblock,0);
  10991. +}
  10992. +
  10993. +
  10994.  static int ipx_recv(struct socket *sock, void *ubuf, int size , int noblock,
  10995.      unsigned flags)
  10996.  {
  10997. @@ -1110,16 +1328,26 @@
  10998.  };
  10999.   
  11000.  
  11001. -void ipx_proto_init(struct ddi_proto *pro)
  11002. +extern struct datalink_proto    *make_EII_client(void);
  11003. +extern struct datalink_proto    *make_8023_client(void);
  11004. +
  11005. +void ipx_proto_init(struct net_proto *pro)
  11006.  {
  11007. +    unsigned char    val = 0xE0;
  11008.      (void) sock_register(ipx_proto_ops.family, &ipx_proto_ops);
  11009. +
  11010. +    pEII_datalink = make_EII_client();
  11011.      ipx_dix_packet_type.type=htons(ETH_P_IPX);
  11012.      dev_add_pack(&ipx_dix_packet_type);
  11013. +
  11014. +    p8023_datalink = make_8023_client();
  11015.      ipx_8023_packet_type.type=htons(ETH_P_802_3);
  11016.      dev_add_pack(&ipx_8023_packet_type);
  11017.      
  11018. -    printk("Swansea University Computer Society IPX 0.24 BETA for NET3 ALPHA.008\n");
  11019. +    if ((p8022_datalink = register_8022_client(val, ipx_rcv)) == NULL)
  11020. +        printk("IPX: Unable to register with 802.2\n");
  11021.      
  11022. +    printk("Swansea University Computer Society IPX 0.25 BETA for NET3 014\n");
  11023. +    
  11024.  }
  11025. -
  11026.  #endif
  11027. Only in linux.old/net/inet: ipx.c.orig
  11028. diff -u --new-file --recursive linux.old/net/inet/ipx.h linux/net/inet/ipx.h
  11029. --- linux.old/net/inet/ipx.h    Fri May 20 18:42:48 1994
  11030. +++ linux/net/inet/ipx.h    Fri May 20 18:50:43 1994
  11031. @@ -8,10 +8,11 @@
  11032.   *    Which is available from ftp.novell.com
  11033.   */
  11034.  
  11035. -#ifndef _IPX_H
  11036. -#define _IPX_H
  11037. +#ifndef _NET_INET_IPX_H_
  11038. +#define _NET_INET_IPX_H_
  11039.  
  11040. -#include <linux/ddi.h>
  11041. +#include <linux/ipx.h>
  11042. +#include "datalink.h"
  11043.  
  11044.  typedef struct
  11045.  {
  11046. @@ -46,10 +47,15 @@
  11047.      unsigned char router_node[6];
  11048.      unsigned long router_net;
  11049.      unsigned short flags;
  11050. -    struct device *dev;
  11051.  #define IPX_RT_ROUTED    1        /* This isn't a direct route. Send via this if to node router_node */
  11052. -#define IPX_RT_BLUEBOOK    2        /* Use DIX 8137 frames not IEE802.3 */
  11053. +#define IPX_RT_BLUEBOOK    2        
  11054. +#define IPX_RT_8022    4        
  11055. +#define IPX_RT_SNAP    8        
  11056. +    unsigned short dlink_type;
  11057. +    struct device *dev;
  11058. +    struct datalink_proto *datalink;
  11059.      struct ipx_route *next;
  11060. +    struct ipx_route *nextlocal;
  11061.  } ipx_route;
  11062.  
  11063.  
  11064. Only in linux.old/net/inet: ipx.h.orig
  11065. diff -u --new-file --recursive linux.old/net/inet/ipxcall.h linux/net/inet/ipxcall.h
  11066. --- linux.old/net/inet/ipxcall.h    Fri May 20 18:42:48 1994
  11067. +++ linux/net/inet/ipxcall.h    Fri May 20 18:50:43 1994
  11068. @@ -1,2 +1,2 @@
  11069. -/* Seperate to keep compilation of Space.c simpler */
  11070. -extern void ipx_proto_init(struct ddi_proto *pro);
  11071. +/* Seperate to keep compilation of protocols.c simpler */
  11072. +extern void ipx_proto_init(struct net_proto *pro);
  11073. Only in linux.old/net/inet: ipxcall.h.orig
  11074. Only in linux.old/net/inet: loopback.c.ori
  11075. diff -u --new-file --recursive linux.old/net/inet/p8022.c linux/net/inet/p8022.c
  11076. --- linux.old/net/inet/p8022.c    Thu Jan  1 01:00:00 1970
  11077. +++ linux/net/inet/p8022.c    Fri May 20 18:50:54 1994
  11078. @@ -0,0 +1,98 @@
  11079. +#include <linux/netdevice.h>
  11080. +#include <linux/skbuff.h>
  11081. +#include "datalink.h"
  11082. +#include <linux/mm.h>
  11083. +#include <linux/in.h>
  11084. +#include <linux/ddi.h>
  11085. +
  11086. +static struct datalink_proto *p8022_list = NULL;
  11087. +
  11088. +static struct datalink_proto *
  11089. +find_8022_client(unsigned char type)
  11090. +{
  11091. +    struct datalink_proto    *proto;
  11092. +
  11093. +    for (proto = p8022_list;
  11094. +        ((proto != NULL) && (*(proto->type) != type));
  11095. +        proto = proto->next)
  11096. +        ;
  11097. +
  11098. +    return proto;
  11099. +}
  11100. +
  11101. +int
  11102. +p8022_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
  11103. +{
  11104. +    struct datalink_proto    *proto;
  11105. +
  11106. +    proto = find_8022_client(*(skb->h.raw));
  11107. +    if (proto != NULL) {
  11108. +        skb->h.raw += 3;
  11109. +        return proto->rcvfunc(skb, dev, pt);
  11110. +    }
  11111. +
  11112. +    skb->sk = NULL;
  11113. +    kfree_skb(skb, FREE_READ);
  11114. +    return 0;
  11115. +}
  11116. +
  11117. +static void
  11118. +p8022_datalink_header(struct datalink_proto *dl, 
  11119. +        struct sk_buff *skb, unsigned char *dest_node)
  11120. +{
  11121. +    struct device    *dev = skb->dev;
  11122. +    unsigned long    len = skb->len;
  11123. +    unsigned long    hard_len = dev->hard_header_len;
  11124. +    unsigned char    *rawp;
  11125. +
  11126. +    dev->hard_header(skb->data, dev, len - hard_len,
  11127. +            dest_node, NULL, len - hard_len, skb);
  11128. +    rawp = skb->data + hard_len;
  11129. +    *rawp = dl->type[0];
  11130. +    rawp++;
  11131. +    *rawp = dl->type[0];
  11132. +    rawp++;
  11133. +    *rawp = 0x03;    /* UI */
  11134. +    rawp++;
  11135. +    skb->h.raw = rawp;
  11136. +}
  11137. +
  11138. +static struct packet_type p8022_packet_type = 
  11139. +{
  11140. +    0,    /* MUTTER ntohs(ETH_P_IPX),*/
  11141. +    0,        /* copy */
  11142. +    p8022_rcv,
  11143. +    NULL,
  11144. +    NULL,
  11145. +};
  11146. +
  11147. +void p8022_proto_init(struct net_proto *pro)
  11148. +{
  11149. +    p8022_packet_type.type=htons(ETH_P_802_2);
  11150. +    dev_add_pack(&p8022_packet_type);
  11151. +}
  11152. +    
  11153. +struct datalink_proto *
  11154. +register_8022_client(unsigned char type, int (*rcvfunc)(struct sk_buff *, struct device *, struct packet_type *))
  11155. +{
  11156. +    struct datalink_proto    *proto;
  11157. +
  11158. +    if (find_8022_client(type) != NULL)
  11159. +        return NULL;
  11160. +
  11161. +    proto = (struct datalink_proto *) kmalloc(sizeof(*proto), GFP_ATOMIC);
  11162. +    if (proto != NULL) {
  11163. +        proto->type[0] = type;
  11164. +        proto->type_len = 1;
  11165. +        proto->rcvfunc = rcvfunc;
  11166. +        proto->header_length = 3;
  11167. +        proto->datalink_header = p8022_datalink_header;
  11168. +    }
  11169. +
  11170. +    proto->next = p8022_list;
  11171. +    p8022_list = proto;
  11172. +
  11173. +    return proto;
  11174. +}
  11175. +
  11176. diff -u --new-file --recursive linux.old/net/inet/p8022.h linux/net/inet/p8022.h
  11177. --- linux.old/net/inet/p8022.h    Thu Jan  1 01:00:00 1970
  11178. +++ linux/net/inet/p8022.h    Fri May 20 18:50:54 1994
  11179. @@ -0,0 +1,2 @@
  11180. +struct datalink_proto *register_8022_client(unsigned char type, int (*rcvfunc)(struct sk_buff *, struct device *, struct packet_type *));
  11181. +
  11182. diff -u --new-file --recursive linux.old/net/inet/p8022call.h linux/net/inet/p8022call.h
  11183. --- linux.old/net/inet/p8022call.h    Thu Jan  1 01:00:00 1970
  11184. +++ linux/net/inet/p8022call.h    Fri May 20 18:50:54 1994
  11185. @@ -0,0 +1,2 @@
  11186. +/* Seperate to keep compilation of Space.c simpler */
  11187. +extern void p8022_proto_init(struct net_proto *);
  11188. diff -u --new-file --recursive linux.old/net/inet/p8023.c linux/net/inet/p8023.c
  11189. --- linux.old/net/inet/p8023.c    Thu Jan  1 01:00:00 1970
  11190. +++ linux/net/inet/p8023.c    Fri May 20 18:50:54 1994
  11191. @@ -0,0 +1,34 @@
  11192. +#include <linux/netdevice.h>
  11193. +#include <linux/skbuff.h>
  11194. +#include "datalink.h"
  11195. +#include <linux/mm.h>
  11196. +#include <linux/in.h>
  11197. +
  11198. +static void
  11199. +p8023_datalink_header(struct datalink_proto *dl, 
  11200. +        struct sk_buff *skb, unsigned char *dest_node)
  11201. +{
  11202. +    struct device    *dev = skb->dev;
  11203. +    unsigned long    len = skb->len;
  11204. +    unsigned long    hard_len = dev->hard_header_len;
  11205. +
  11206. +    dev->hard_header(skb->data, dev, len - hard_len,
  11207. +            dest_node, NULL, len - hard_len, skb);
  11208. +    skb->h.raw = skb->data + hard_len;
  11209. +}
  11210. +
  11211. +struct datalink_proto *
  11212. +make_8023_client(void)
  11213. +{
  11214. +    struct datalink_proto    *proto;
  11215. +
  11216. +    proto = (struct datalink_proto *) kmalloc(sizeof(*proto), GFP_ATOMIC);
  11217. +    if (proto != NULL) {
  11218. +        proto->type_len = 0;
  11219. +        proto->header_length = 0;
  11220. +        proto->datalink_header = p8023_datalink_header;
  11221. +    }
  11222. +
  11223. +    return proto;
  11224. +}
  11225. +
  11226. diff -u --new-file --recursive linux.old/net/inet/packet.c linux/net/inet/packet.c
  11227. --- linux.old/net/inet/packet.c    Fri May 20 18:42:49 1994
  11228. +++ linux/net/inet/packet.c    Fri May 20 18:50:39 1994
  11229. @@ -193,8 +193,7 @@
  11230.       
  11231.      if (skb == NULL) 
  11232.      {
  11233. -        DPRINTF((DBG_PKT, "packet_sendto: write buffer full?\n"));
  11234. -        return(-ENOMEM);
  11235. +        return(-ENOBUFS);
  11236.      }
  11237.      
  11238.      /*
  11239. Only in linux.old/net/inet: packet.c.orig
  11240. diff -u --new-file --recursive linux.old/net/inet/pe2.c linux/net/inet/pe2.c
  11241. --- linux.old/net/inet/pe2.c    Thu Jan  1 01:00:00 1970
  11242. +++ linux/net/inet/pe2.c    Fri May 20 18:50:54 1994
  11243. @@ -0,0 +1,34 @@
  11244. +#include <linux/netdevice.h>
  11245. +#include <linux/skbuff.h>
  11246. +#include "datalink.h"
  11247. +#include <linux/mm.h>
  11248. +#include <linux/in.h>
  11249. +
  11250. +static void
  11251. +pEII_datalink_header(struct datalink_proto *dl, 
  11252. +        struct sk_buff *skb, unsigned char *dest_node)
  11253. +{
  11254. +    struct device    *dev = skb->dev;
  11255. +    unsigned long    len = skb->len;
  11256. +    unsigned long    hard_len = dev->hard_header_len;
  11257. +
  11258. +    dev->hard_header(skb->data, dev, ETH_P_IPX,
  11259. +            dest_node, NULL, len - hard_len, skb);
  11260. +    skb->h.raw = skb->data + hard_len;
  11261. +}
  11262. +
  11263. +struct datalink_proto *
  11264. +make_EII_client(void)
  11265. +{
  11266. +    struct datalink_proto    *proto;
  11267. +
  11268. +    proto = (struct datalink_proto *) kmalloc(sizeof(*proto), GFP_ATOMIC);
  11269. +    if (proto != NULL) {
  11270. +        proto->type_len = 0;
  11271. +        proto->header_length = 0;
  11272. +        proto->datalink_header = pEII_datalink_header;
  11273. +    }
  11274. +
  11275. +    return proto;
  11276. +}
  11277. +
  11278. Only in linux.old/net/inet: proc.c.orig
  11279. diff -u --new-file --recursive linux.old/net/inet/protocol.c linux/net/inet/protocol.c
  11280. --- linux.old/net/inet/protocol.c    Fri May 20 18:42:51 1994
  11281. +++ linux/net/inet/protocol.c    Fri May 20 18:50:40 1994
  11282. @@ -88,10 +88,8 @@
  11283.    unsigned char hash;
  11284.    struct inet_protocol *p;
  11285.  
  11286. -  DPRINTF((DBG_PROTO, "get_protocol (%d)\n ", prot));
  11287.    hash = prot & (MAX_INET_PROTOS - 1);
  11288.    for (p = inet_protos[hash] ; p != NULL; p=p->next) {
  11289. -    DPRINTF((DBG_PROTO, "trying protocol %d\n", p->protocol));
  11290.      if (p->protocol == prot) return((struct inet_protocol *) p);
  11291.    }
  11292.    return(NULL);
  11293. Only in linux.old/net/inet: protocol.c.ori
  11294. Only in linux.old/net/inet: rarp.c.orig
  11295. Only in linux.old/net/inet: rarp.h.orig
  11296. diff -u --new-file --recursive linux.old/net/inet/raw.c linux/net/inet/raw.c
  11297. --- linux.old/net/inet/raw.c    Fri May 20 18:43:45 1994
  11298. +++ linux/net/inet/raw.c    Fri May 20 18:50:39 1994
  11299. @@ -23,6 +23,7 @@
  11300.   *        Alan Cox    :    Fixed error return for broadcasts
  11301.   *        Alan Cox    :    Removed wake_up calls
  11302.   *        Alan Cox    :    Use ttl/tos
  11303. + *        Alan Cox    :    Cleaned up old debugging
  11304.   *
  11305.   *        This program is free software; you can redistribute it and/or
  11306.   *        modify it under the terms of the GNU General Public License
  11307. @@ -44,9 +45,6 @@
  11308.  #include <linux/netdevice.h>
  11309.  #include "ip.h"
  11310.  #include "protocol.h"
  11311. -#if 0
  11312. -#include "tcp.h"
  11313. -#endif
  11314.  #include <linux/skbuff.h>
  11315.  #include "sock.h"
  11316.  #include "icmp.h"
  11317. @@ -68,9 +66,6 @@
  11318.  {
  11319.    struct sock *sk;
  11320.     
  11321. -  DPRINTF((DBG_RAW, "raw_err(err=%d, hdr=%X, daddr=%X, saddr=%X, protocl=%X)\n",
  11322. -        err, header, daddr, saddr, protocol));
  11323. -
  11324.    if (protocol == NULL) return;
  11325.    sk = (struct sock *) protocol->data;
  11326.    if (sk == NULL) return;
  11327. @@ -99,10 +94,6 @@
  11328.  {
  11329.    struct sock *sk;
  11330.  
  11331. -  DPRINTF((DBG_RAW, "raw_rcv(skb=%X, dev=%X, opt=%X, daddr=%X,\n"
  11332. -       "         len=%d, saddr=%X, redo=%d, protocol=%X)\n",
  11333. -       skb, dev, opt, daddr, len, saddr, redo, protocol));
  11334. -
  11335.    if (skb == NULL)
  11336.        return(0);
  11337.        
  11338. @@ -155,22 +146,12 @@
  11339.      int tmp;
  11340.      int err;
  11341.  
  11342. -    DPRINTF((DBG_RAW, "raw_sendto(sk=%X, from=%X, len=%d, noblock=%d, flags=%X,\n"
  11343. -        "            usin=%X, addr_len = %d)\n", sk, from, len, noblock,
  11344. -        flags, usin, addr_len));
  11345. -
  11346.      /*
  11347.       *    Check the flags. Only MSG_DONTROUTE is permitted.
  11348.       */
  11349.       
  11350.      if (flags&MSG_DONTROUTE)
  11351.          return(-EINVAL);
  11352. -    if (len < 0) 
  11353. -        return(-EINVAL);
  11354. -
  11355. -    err=verify_area(VERIFY_READ,from,len);
  11356. -    if(err)
  11357. -        return err;
  11358.      /*
  11359.       *    Get and verify the address. 
  11360.       */
  11361. @@ -222,7 +203,6 @@
  11362.          {
  11363.              int tmp;
  11364.  
  11365. -            DPRINTF((DBG_RAW, "raw_sendto: write buffer full?\n"));
  11366.              if (noblock) 
  11367.                  return(-EAGAIN);
  11368.              tmp = sk->wmem_alloc;
  11369. @@ -248,7 +228,6 @@
  11370.                     sk->protocol, sk->opt, skb->mem_len, sk->ip_tos,sk->ip_ttl);
  11371.      if (tmp < 0) 
  11372.      {
  11373. -        DPRINTF((DBG_RAW, "raw_sendto: error building ip header.\n"));
  11374.          kfree_skb(skb,FREE_WRITE);
  11375.          release_sock(sk);
  11376.          return(tmp);
  11377. @@ -293,11 +272,7 @@
  11378.      sk->inuse = 1;
  11379.      sk->state = TCP_CLOSE;
  11380.  
  11381. -    DPRINTF((DBG_RAW, "raw_close: deleting protocol %d\n",
  11382. -       ((struct inet_protocol *)sk->pair)->protocol));
  11383. -
  11384. -    if (inet_del_protocol((struct inet_protocol *)sk->pair) < 0)
  11385. -        DPRINTF((DBG_RAW, "raw_close: del_protocol failed.\n"));
  11386. +    inet_del_protocol((struct inet_protocol *)sk->pair);
  11387.      kfree_s((void *)sk->pair, sizeof (struct inet_protocol));
  11388.      sk->pair = NULL;
  11389.      release_sock(sk);
  11390. @@ -323,8 +298,6 @@
  11391.    /* We need to remember this somewhere. */
  11392.    sk->pair = (struct sock *)p;
  11393.  
  11394. -  DPRINTF((DBG_RAW, "raw init added protocol %d\n", sk->protocol));
  11395. -
  11396.    return(0);
  11397.  }
  11398.  
  11399. @@ -341,10 +314,6 @@
  11400.    int copied=0;
  11401.    struct sk_buff *skb;
  11402.    int err;
  11403. -
  11404. -  DPRINTF((DBG_RAW, "raw_recvfrom (sk=%X, to=%X, len=%d, noblock=%d, flags=%X,\n"
  11405. -       "              sin=%X, addr_len=%X)\n",
  11406. -        sk, to, len, noblock, flags, sin, addr_len));
  11407.  
  11408.    if (len == 0) return(0);
  11409.    if (len < 0) return(-EINVAL);
  11410. Only in linux.old/net/inet: raw.c.orig
  11411. diff -u --new-file --recursive linux.old/net/inet/route.c linux/net/inet/route.c
  11412. --- linux.old/net/inet/route.c    Fri May 20 18:43:17 1994
  11413. +++ linux/net/inet/route.c    Fri May 20 18:50:40 1994
  11414. @@ -20,6 +20,7 @@
  11415.   *        Linus Torvalds    :    Rewrote bits to be sensible
  11416.   *        Alan Cox    :    Added BSD route gw semantics
  11417.   *        Alan Cox    :    Super /proc >4K 
  11418. + *        Alan Cox    :    MTU in route table
  11419.   *
  11420.   *        This program is free software; you can redistribute it and/or
  11421.   *        modify it under the terms of the GNU General Public License
  11422. @@ -60,26 +61,6 @@
  11423.  static struct rtable *rt_loopback = NULL;
  11424.  
  11425.  /*
  11426. - *    Dump the contents of a routing table entry. 
  11427. - */
  11428. -static void rt_print(struct rtable *rt)
  11429. -{
  11430. -
  11431. -    if (rt == NULL || inet_debug != DBG_RT) 
  11432. -          return;
  11433. -
  11434. -    printk("RT: %06lx NXT=%06lx FLAGS=0x%02x\n",
  11435. -        (long) rt, (long) rt->rt_next, rt->rt_flags);
  11436. -    printk("    TARGET=%s ", in_ntoa(rt->rt_dst));
  11437. -    printk("GW=%s ", in_ntoa(rt->rt_gateway));
  11438. -    printk("    DEV=%s USE=%ld REF=%d\n",
  11439. -        (rt->rt_dev == NULL) ? "NONE" : rt->rt_dev->name,
  11440. -        rt->rt_use, rt->rt_refcnt);
  11441. -}
  11442. -
  11443. -
  11444. -/*
  11445.   *    Remove a routing table entry.
  11446.   */
  11447.  
  11448. @@ -88,7 +69,6 @@
  11449.      struct rtable *r, **rp;
  11450.      unsigned long flags;
  11451.  
  11452. -    DPRINTF((DBG_RT, "RT: flushing for dst %s\n", in_ntoa(dst)));
  11453.      rp = &rt_base;
  11454.      
  11455.      /*
  11456. @@ -130,7 +110,6 @@
  11457.      struct rtable **rp;
  11458.      unsigned long flags;
  11459.  
  11460. -    DPRINTF((DBG_RT, "RT: flushing for dev 0x%08lx (%s)\n", (long)dev, dev->name));
  11461.      rp = &rt_base;
  11462.      cli();
  11463.      save_flags(flags);
  11464. @@ -216,7 +195,7 @@
  11465.   */
  11466.   
  11467.  void ip_rt_add(short flags, unsigned long dst, unsigned long mask,
  11468. -    unsigned long gw, struct device *dev)
  11469. +    unsigned long gw, struct device *dev, unsigned short mtu)
  11470.  {
  11471.      struct rtable *r, *rt;
  11472.      struct rtable **rp;
  11473. @@ -280,7 +259,6 @@
  11474.      rt = (struct rtable *) kmalloc(sizeof(struct rtable), GFP_ATOMIC);
  11475.      if (rt == NULL) 
  11476.      {
  11477. -        DPRINTF((DBG_RT, "RT: no memory for new route!\n"));
  11478.          return;
  11479.      }
  11480.      memset(rt, 0, sizeof(struct rtable));
  11481. @@ -290,8 +268,12 @@
  11482.      rt->rt_gateway = gw;
  11483.      rt->rt_mask = mask;
  11484.      rt->rt_mtu = dev->mtu;
  11485. -    rt_print(rt);
  11486.  
  11487. +    /* Are the MSS/Window valid ? */
  11488. +
  11489. +    if(rt->rt_flags & RTF_MTU)
  11490. +        rt->rt_mtu = mtu;
  11491. +
  11492.      /*
  11493.       *    What we have to do is loop though this until we have
  11494.       *    found the first address which has a higher generality than
  11495. @@ -467,7 +449,7 @@
  11496.       *    Add the route
  11497.       */
  11498.       
  11499. -    ip_rt_add(flags, daddr, mask, gw, dev);
  11500. +    ip_rt_add(flags, daddr, mask, gw, dev, r->rt_mtu);
  11501.      return 0;
  11502.  }
  11503.  
  11504. @@ -499,7 +481,7 @@
  11505.      int size;
  11506.  
  11507.      len += sprintf(buffer,
  11508. -         "Iface\tDestination\tGateway \tFlags\tRefCnt\tUse\tMetric\tMask\n");
  11509. +         "Iface\tDestination\tGateway \tFlags\tRefCnt\tUse\tMetric\tMask\tMTU\n");
  11510.      pos=len;
  11511.    
  11512.      /*
  11513. @@ -508,10 +490,10 @@
  11514.       
  11515.      for (r = rt_base; r != NULL; r = r->rt_next) 
  11516.      {
  11517. -            size = sprintf(buffer+len, "%s\t%08lX\t%08lX\t%02X\t%d\t%lu\t%d\t%08lX\n",
  11518. +            size = sprintf(buffer+len, "%s\t%08lX\t%08lX\t%02X\t%d\t%lu\t%d\t%08lX\t%d\n",
  11519.              r->rt_dev->name, r->rt_dst, r->rt_gateway,
  11520.              r->rt_flags, r->rt_refcnt, r->rt_use, r->rt_metric,
  11521. -            r->rt_mask);
  11522. +            r->rt_mask, (int)r->rt_mtu);
  11523.          len+=size;
  11524.          pos+=size;
  11525.          if(pos<offset)
  11526. @@ -644,9 +626,6 @@
  11527.  
  11528.      switch(cmd) 
  11529.      {
  11530. -        case DDIOCSDBG:        /* Control debugging */
  11531. -            return dbg_ioctl(arg, DBG_RT);
  11532. -    
  11533.          case SIOCADDRTOLD:    /* Old style add route */
  11534.          case SIOCDELRTOLD:    /* Old style delete route */
  11535.              if (!suser())
  11536. Only in linux.old/net/inet: route.c.orig
  11537. diff -u --new-file --recursive linux.old/net/inet/route.h linux/net/inet/route.h
  11538. --- linux.old/net/inet/route.h    Fri May 20 18:43:17 1994
  11539. +++ linux/net/inet/route.h    Fri May 20 18:50:40 1994
  11540. @@ -11,6 +11,7 @@
  11541.   *        Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  11542.   * Fixes:
  11543.   *        Alan Cox    :    Reformatted. Added ip_rt_local()
  11544. + *        Alan Cox    :    Support for TCP parameters.
  11545.   *
  11546.   *        This program is free software; you can redistribute it and/or
  11547.   *        modify it under the terms of the GNU General Public License
  11548. @@ -42,7 +43,7 @@
  11549.  
  11550.  extern void        ip_rt_flush(struct device *dev);
  11551.  extern void        ip_rt_add(short flags, unsigned long addr, unsigned long mask,
  11552. -                   unsigned long gw, struct device *dev);
  11553. +                   unsigned long gw, struct device *dev, unsigned short);
  11554.  extern struct rtable    *ip_rt_route(unsigned long daddr, struct options *opt, unsigned long *src_addr);
  11555.  extern struct rtable     *ip_rt_local(unsigned long daddr, struct options *opt, unsigned long *src_addr);
  11556.  extern int        rt_get_info(char * buffer, char **start, off_t offset, int length);
  11557. Only in linux.old/net/inet: route.h.orig
  11558. diff -u --new-file --recursive linux.old/net/inet/skbuff.c linux/net/inet/skbuff.c
  11559. --- linux.old/net/inet/skbuff.c    Fri May 20 18:46:37 1994
  11560. +++ linux/net/inet/skbuff.c    Fri May 20 18:50:41 1994
  11561. @@ -421,12 +421,20 @@
  11562.              else
  11563.                  skb->sk->wmem_alloc-=skb->mem_len;
  11564.              if(!skb->sk->dead)
  11565. -                wake_up_interruptible(skb->sk->sleep);
  11566. +                skb->sk->write_space(skb->sk);
  11567. +#ifdef CONFIG_SLAVE_BALANCING                
  11568. +            if(skb->in_dev_queue && skb->dev!=NULL)
  11569. +                skb->dev->pkt_queue--;
  11570. +#endif
  11571.              kfree_skbmem(skb->mem_addr,skb->mem_len);
  11572.          }
  11573.      } 
  11574.      else 
  11575. +    {
  11576. +        if(skb->in_dev_queue && skb->dev!=NULL)
  11577. +            skb->dev->pkt_queue--;
  11578.          kfree_skbmem(skb->mem_addr, skb->mem_len);
  11579. +    }
  11580.  }
  11581.  
  11582.  /*
  11583. @@ -457,6 +465,9 @@
  11584.       skb->truesize = size;
  11585.       skb->mem_len = size;
  11586.       skb->mem_addr = skb;
  11587. +#ifdef CONFIG_SLAVE_BALANCING     
  11588. +     skb->in_dev_queue = 0;
  11589. +#endif     
  11590.       skb->fraglist = NULL;
  11591.      skb->prev = skb->next = NULL;
  11592.      skb->link3 = NULL;
  11593. @@ -477,8 +488,19 @@
  11594.  
  11595.  void kfree_skbmem(void *mem,unsigned size)
  11596.  {
  11597. +#ifdef CONFIG_SLAVE_BALANCING
  11598. +    struct sk_buff *x = mem;
  11599. +    unsigned long flags;
  11600. +    save_flags(flags);
  11601. +    cli();
  11602. +    if(x->in_dev_queue && x->dev!=NULL)
  11603. +        x->dev->pkt_queue--;
  11604. +    restore_flags(flags);
  11605. +#endif    
  11606.  #if CONFIG_SKB_CHECK
  11607. +#ifndef CONFIG_SLAVE_BALANCING
  11608.      struct sk_buff *x = mem;
  11609. +#endif    
  11610.      IS_SKB(x);
  11611.      if(x->magic_debug_cookie == SK_GOOD_SKB)
  11612.      {
  11613. Only in linux.old/net/inet: skbuff.c.orig
  11614. Only in linux.old/net/inet: skbuff.h.orig
  11615. Only in linux.old/net/inet: snmp.h.orig
  11616. diff -u --new-file --recursive linux.old/net/inet/sock.c linux/net/inet/sock.c
  11617. --- linux.old/net/inet/sock.c    Fri May 20 18:47:41 1994
  11618. +++ linux/net/inet/sock.c    Fri May 20 18:50:39 1994
  11619. @@ -3,13 +3,16 @@
  11620.   *        operating system.  INET is implemented using the  BSD Socket
  11621.   *        interface as the means of communication with the user level.
  11622.   *
  11623. - *        SOCK - AF_INET protocol family socket handler.
  11624. + *        Generic socket support routines. Memory allocators, sk->inuse/release
  11625. + *        handler for protocols to use and generic option handler.
  11626.   *
  11627. + *
  11628.   * Version:    @(#)sock.c    1.0.17    06/02/93
  11629.   *
  11630.   * Authors:    Ross Biro, <bir7@leland.Stanford.Edu>
  11631.   *        Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  11632.   *        Florian La Roche, <flla@stud.uni-sb.de>
  11633. + *        Alan Cox, <A.Cox@swansea.ac.uk>
  11634.   *
  11635.   * Fixes:
  11636.   *        Alan Cox    :     Numerous verify_area() problems
  11637. @@ -53,6 +56,10 @@
  11638.   *        Alan Cox    :    Callbacks
  11639.   *        Alan Cox    :    Nagle flag for Charles & Johannes stuff
  11640.   *        Alex        :    Removed restriction on inet fioctl
  11641. + *        Alan Cox    :    Splitting INET from NET core
  11642. + *        Alan Cox    :    Fixed bogus SO_TYPE handling in getsockopt()
  11643. + *        Adam Caldwell    :    Missing return in SO_DONTROUTE/SO_DEBUG code
  11644. + *        Alan Cox    :    Split IP from generic code
  11645.   *
  11646.   * To Fix:
  11647.   *
  11648. @@ -96,373 +103,8 @@
  11649.  #include "raw.h"
  11650.  #include "icmp.h"
  11651.  
  11652. -
  11653. -int inet_debug = DBG_OFF;        /* INET module debug flag    */
  11654. -
  11655. -
  11656.  #define min(a,b)    ((a)<(b)?(a):(b))
  11657.  
  11658. -extern struct proto packet_prot;
  11659. -
  11660. -
  11661. -void
  11662. -print_sk(struct sock *sk)
  11663. -{
  11664. -  if (!sk) {
  11665. -    printk("  print_sk(NULL)\n");
  11666. -    return;
  11667. -  }
  11668. -  printk("  wmem_alloc = %lu\n", sk->wmem_alloc);
  11669. -  printk("  rmem_alloc = %lu\n", sk->rmem_alloc);
  11670. -  printk("  state = %d\n",sk->state);
  11671. -  printk("  daddr = %lX, saddr = %lX\n", sk->daddr,sk->saddr);
  11672. -  printk("  num = %d", sk->num);
  11673. -  printk(" next = %p\n", sk->next);
  11674. -  printk("  write_seq = %ld, acked_seq = %ld, copied_seq = %ld\n",
  11675. -      sk->write_seq, sk->acked_seq, sk->copied_seq);
  11676. -  printk("  rcv_ack_seq = %ld, window_seq = %ld, fin_seq = %ld\n",
  11677. -      sk->rcv_ack_seq, sk->window_seq, sk->fin_seq);
  11678. -  printk("  prot = %p\n", sk->prot);
  11679. -  printk("  pair = %p\n", sk->pair);
  11680. -  printk("  inuse = %d , blog = %d\n", sk->inuse, sk->blog);
  11681. -  printk("  dead = %d delay_acks=%d\n", sk->dead, sk->delay_acks);
  11682. -  printk("  retransmits = %ld, timeout = %d\n", sk->retransmits, sk->timeout);
  11683. -  printk("  cong_window = %d, packets_out = %d\n", sk->cong_window,
  11684. -      sk->packets_out);
  11685. -  printk("  shutdown=%d\n", sk->shutdown);
  11686. -}
  11687. -
  11688. -
  11689. -#if 0
  11690. -void
  11691. -print_skb(struct sk_buff *skb)
  11692. -{
  11693. -  if (!skb) {
  11694. -    printk("  print_skb(NULL)\n");
  11695. -    return;
  11696. -  }
  11697. -  printk("  prev = %p, next = %p\n", skb->prev, skb->next);
  11698. -  printk("  sk = %p link3 = %p\n", skb->sk, skb->link3);
  11699. -  printk("  mem_addr = %p, mem_len = %lu\n", skb->mem_addr, skb->mem_len);
  11700. -  printk("  used = %d free = %d\n", skb->used,skb->free);
  11701. -}
  11702. -#endif
  11703. -
  11704. -
  11705. -
  11706. -static int
  11707. -sk_inuse(struct proto *prot, int num)
  11708. -{
  11709. -  struct sock *sk;
  11710. -
  11711. -  for(sk = prot->sock_array[num & (SOCK_ARRAY_SIZE -1 )];
  11712. -      sk != NULL;
  11713. -      sk=sk->next) {
  11714. -    if (sk->num == num) return(1);
  11715. -  }
  11716. -  return(0);
  11717. -}
  11718. -
  11719. -
  11720. -unsigned short
  11721. -get_new_socknum(struct proto *prot, unsigned short base)
  11722. -{
  11723. -  static int start=0;
  11724. -
  11725. -  /*
  11726. -   * Used to cycle through the port numbers so the
  11727. -   * chances of a confused connection drop.
  11728. -   */
  11729. -  int i, j;
  11730. -  int best = 0;
  11731. -  int size = 32767; /* a big num. */
  11732. -  struct sock *sk;
  11733. -
  11734. -  if (base == 0) base = PROT_SOCK+1+(start % 1024);
  11735. -  if (base <= PROT_SOCK) {
  11736. -    base += PROT_SOCK+(start % 1024);
  11737. -  }
  11738. -
  11739. -  /* Now look through the entire array and try to find an empty ptr. */
  11740. -  for(i=0; i < SOCK_ARRAY_SIZE; i++) {
  11741. -    j = 0;
  11742. -    sk = prot->sock_array[(i+base+1) &(SOCK_ARRAY_SIZE -1)];
  11743. -    while(sk != NULL) {
  11744. -        sk = sk->next;
  11745. -        j++;
  11746. -    }
  11747. -    if (j == 0) {
  11748. -        start =(i+1+start )%1024;
  11749. -        DPRINTF((DBG_INET, "get_new_socknum returning %d, start = %d\n",
  11750. -                            i + base + 1, start));
  11751. -        return(i+base+1);
  11752. -    }
  11753. -    if (j < size) {
  11754. -        best = i;
  11755. -        size = j;
  11756. -    }
  11757. -  }
  11758. -
  11759. -  /* Now make sure the one we want is not in use. */
  11760. -  while(sk_inuse(prot, base +best+1)) {
  11761. -    best += SOCK_ARRAY_SIZE;
  11762. -  }
  11763. -  DPRINTF((DBG_INET, "get_new_socknum returning %d, start = %d\n",
  11764. -                        best + base + 1, start));
  11765. -  return(best+base+1);
  11766. -}
  11767. -
  11768. -
  11769. -void
  11770. -put_sock(unsigned short num, struct sock *sk)
  11771. -{
  11772. -  struct sock *sk1;
  11773. -  struct sock *sk2;
  11774. -  int mask;
  11775. -
  11776. -  DPRINTF((DBG_INET, "put_sock(num = %d, sk = %X\n", num, sk));
  11777. -  sk->num = num;
  11778. -  sk->next = NULL;
  11779. -  num = num &(SOCK_ARRAY_SIZE -1);
  11780. -
  11781. -  /* We can't have an interupt re-enter here. */
  11782. -  cli();
  11783. -  if (sk->prot->sock_array[num] == NULL) {
  11784. -    sk->prot->sock_array[num] = sk;
  11785. -    sti();
  11786. -    return;
  11787. -  }
  11788. -  sti();
  11789. -  for(mask = 0xff000000; mask != 0xffffffff; mask = (mask >> 8) | mask) {
  11790. -    if ((mask & sk->saddr) &&
  11791. -        (mask & sk->saddr) != (mask & 0xffffffff)) {
  11792. -        mask = mask << 8;
  11793. -        break;
  11794. -    }
  11795. -  }
  11796. -  DPRINTF((DBG_INET, "mask = %X\n", mask));
  11797. -
  11798. -  cli();
  11799. -  sk1 = sk->prot->sock_array[num];
  11800. -  for(sk2 = sk1; sk2 != NULL; sk2=sk2->next) {
  11801. -    if (!(sk2->saddr & mask)) {
  11802. -        if (sk2 == sk1) {
  11803. -            sk->next = sk->prot->sock_array[num];
  11804. -            sk->prot->sock_array[num] = sk;
  11805. -            sti();
  11806. -            return;
  11807. -        }
  11808. -        sk->next = sk2;
  11809. -        sk1->next= sk;
  11810. -        sti();
  11811. -        return;
  11812. -    }
  11813. -    sk1 = sk2;
  11814. -  }
  11815. -
  11816. -  /* Goes at the end. */
  11817. -  sk->next = NULL;
  11818. -  sk1->next = sk;
  11819. -  sti();
  11820. -}
  11821. -
  11822. -
  11823. -static void
  11824. -remove_sock(struct sock *sk1)
  11825. -{
  11826. -  struct sock *sk2;
  11827. -
  11828. -  DPRINTF((DBG_INET, "remove_sock(sk1=%X)\n", sk1));
  11829. -
  11830. -  if (!sk1->prot) {
  11831. -    printk("sock.c: remove_sock: sk1->prot == NULL\n");
  11832. -    return;
  11833. -  }
  11834. -
  11835. -  /* We can't have this changing out from under us. */
  11836. -  cli();
  11837. -  sk2 = sk1->prot->sock_array[sk1->num &(SOCK_ARRAY_SIZE -1)];
  11838. -  if (sk2 == sk1) {
  11839. -    sk1->prot->sock_array[sk1->num &(SOCK_ARRAY_SIZE -1)] = sk1->next;
  11840. -    sti();
  11841. -    return;
  11842. -  }
  11843. -
  11844. -  while(sk2 && sk2->next != sk1) {
  11845. -    sk2 = sk2->next;
  11846. -  }
  11847. -
  11848. -  if (sk2) {
  11849. -    sk2->next = sk1->next;
  11850. -    sti();
  11851. -    return;
  11852. -  }
  11853. -  sti();
  11854. -
  11855. -  if (sk1->num != 0) DPRINTF((DBG_INET, "remove_sock: sock not found.\n"));
  11856. -}
  11857. -
  11858. -
  11859. -void
  11860. -destroy_sock(struct sock *sk)
  11861. -{
  11862. -    struct sk_buff *skb;
  11863. -
  11864. -      DPRINTF((DBG_INET, "destroying socket %X\n", sk));
  11865. -      sk->inuse = 1;            /* just to be safe. */
  11866. -
  11867. -      /* Incase it's sleeping somewhere. */
  11868. -      if (!sk->dead) 
  11869. -          sk->write_space(sk);
  11870. -
  11871. -      remove_sock(sk);
  11872. -  
  11873. -      /* Now we can no longer get new packets. */
  11874. -      delete_timer(sk);
  11875. -
  11876. -    while ((skb = tcp_dequeue_partial(sk)) != NULL) {
  11877. -        IS_SKB(skb);
  11878. -        kfree_skb(skb, FREE_WRITE);
  11879. -    }
  11880. -
  11881. -    /* Cleanup up the write buffer. */
  11882. -      while((skb = skb_dequeue(&sk->write_queue)) != NULL) {
  11883. -        IS_SKB(skb);
  11884. -        kfree_skb(skb, FREE_WRITE);
  11885. -      }
  11886. -
  11887. -      while((skb=skb_dequeue(&sk->receive_queue))!=NULL) {
  11888. -    /*
  11889. -     * This will take care of closing sockets that were
  11890. -     * listening and didn't accept everything.
  11891. -     */
  11892. -        if (skb->sk != NULL && skb->sk != sk) 
  11893. -        {
  11894. -            IS_SKB(skb);
  11895. -            skb->sk->dead = 1;
  11896. -            skb->sk->prot->close(skb->sk, 0);
  11897. -        }
  11898. -        IS_SKB(skb);
  11899. -        kfree_skb(skb, FREE_READ);
  11900. -    }
  11901. -
  11902. -  /* Now we need to clean up the send head. */
  11903. -    cli();
  11904. -    for(skb = sk->send_head; skb != NULL; )
  11905. -    {
  11906. -        struct sk_buff *skb2;
  11907. -
  11908. -        /*
  11909. -         * We need to remove skb from the transmit queue,
  11910. -         * or maybe the arp queue.
  11911. -         */
  11912. -        if (skb->next  && skb->prev) {
  11913. -            printk("destroy_sock: unlinked skb\n");
  11914. -            IS_SKB(skb);
  11915. -            skb_unlink(skb);
  11916. -        }
  11917. -        skb->dev = NULL;
  11918. -        skb2 = skb->link3;
  11919. -        kfree_skb(skb, FREE_WRITE);
  11920. -        skb = skb2;
  11921. -    }
  11922. -    sk->send_head = NULL;
  11923. -    sti();
  11924. -
  11925. -      /* And now the backlog. */
  11926. -      while((skb=skb_dequeue(&sk->back_log))!=NULL) {
  11927. -        /* this should never happen. */
  11928. -        printk("cleaning back_log\n");
  11929. -        kfree_skb(skb, FREE_READ);
  11930. -    }
  11931. -
  11932. -  /* Now if it has a half accepted/ closed socket. */
  11933. -    if (sk->pair) 
  11934. -    {
  11935. -        sk->pair->dead = 1;
  11936. -        sk->pair->prot->close(sk->pair, 0);
  11937. -        sk->pair = NULL;
  11938. -      }
  11939. -
  11940. -  /*
  11941. -   * Now if everything is gone we can free the socket
  11942. -   * structure, otherwise we need to keep it around until
  11943. -   * everything is gone.
  11944. -   */
  11945. -      if (sk->dead && sk->rmem_alloc == 0 && sk->wmem_alloc == 0) 
  11946. -      {
  11947. -        kfree_s((void *)sk,sizeof(*sk));
  11948. -      } 
  11949. -      else 
  11950. -      {
  11951. -        /* this should never happen. */
  11952. -        /* actually it can if an ack has just been sent. */
  11953. -        DPRINTF((DBG_INET, "possible memory leak in socket = %X\n", sk));
  11954. -        sk->destroy = 1;
  11955. -        sk->ack_backlog = 0;
  11956. -        sk->inuse = 0;
  11957. -        reset_timer(sk, TIME_DESTROY, SOCK_DESTROY_TIME);
  11958. -      }
  11959. -      DPRINTF((DBG_INET, "leaving destroy_sock\n"));
  11960. -}
  11961. -
  11962. -
  11963. -static int
  11964. -inet_fcntl(struct socket *sock, unsigned int cmd, unsigned long arg)
  11965. -{
  11966. -  struct sock *sk;
  11967. -
  11968. -  sk = (struct sock *) sock->data;
  11969. -
  11970. -  switch(cmd) {
  11971. -    case F_SETOWN:
  11972. -        /*
  11973. -         * This is a little restrictive, but it's the only
  11974. -         * way to make sure that you can't send a sigurg to
  11975. -         * another process.
  11976. -         */
  11977. -        if (!suser() && current->pgrp != -arg &&
  11978. -                current->pid != arg) return(-EPERM);
  11979. -        sk->proc = arg;
  11980. -        return(0);
  11981. -    case F_GETOWN:
  11982. -        return(sk->proc);
  11983. -    default:
  11984. -        return(-EINVAL);
  11985. -  }
  11986. -}
  11987. -
  11988. -/*
  11989. - *    Set socket options on an inet socket.
  11990. - */
  11991. -static int inet_setsockopt(struct socket *sock, int level, int optname,
  11992. -            char *optval, int optlen)
  11993. -{
  11994. -      struct sock *sk = (struct sock *) sock->data;  
  11995. -    if (level == SOL_SOCKET)
  11996. -        return sock_setsockopt(sk,level,optname,optval,optlen);
  11997. -    if (sk->prot->setsockopt==NULL)
  11998. -        return(-EOPNOTSUPP);
  11999. -    else
  12000. -        return sk->prot->setsockopt(sk,level,optname,optval,optlen);
  12001. -}
  12002. -
  12003. -
  12004. -
  12005. -
  12006. -static int inet_getsockopt(struct socket *sock, int level, int optname,
  12007. -            char *optval, int *optlen)
  12008. -{
  12009. -      struct sock *sk = (struct sock *) sock->data;      
  12010. -      if (level == SOL_SOCKET) 
  12011. -          return sock_getsockopt(sk,level,optname,optval,optlen);
  12012. -      if(sk->prot->getsockopt==NULL)      
  12013. -          return(-EOPNOTSUPP);
  12014. -      else
  12015. -          return sk->prot->getsockopt(sk,level,optname,optval,optlen);
  12016. -}
  12017. -
  12018.  /*
  12019.   *    This is meant for all protocols to use and covers goings on
  12020.   *    at the socket level. Everything here is generic.
  12021. @@ -491,9 +133,10 @@
  12022.  
  12023.          case SO_DEBUG:    
  12024.              sk->debug=val?1:0;
  12025. +            return 0;
  12026.          case SO_DONTROUTE:
  12027.              sk->localroute=val?1:0;
  12028. -            return(0);
  12029. +            return 0;
  12030.          case SO_BROADCAST:
  12031.              sk->broadcast=val?1:0;
  12032.              return 0;
  12033. @@ -621,10 +264,13 @@
  12034.              break;
  12035.  
  12036.          case SO_TYPE:
  12037. +#if 0        
  12038.              if (sk->prot == &tcp_prot) 
  12039.                  val = SOCK_STREAM;
  12040.                else 
  12041.                    val = SOCK_DGRAM;
  12042. +#endif
  12043. +            val = sk->type;                  
  12044.              break;
  12045.  
  12046.          case SO_ERROR:
  12047. @@ -661,866 +307,6 @@
  12048.  }
  12049.  
  12050.  
  12051. -
  12052. -
  12053. -static int
  12054. -inet_listen(struct socket *sock, int backlog)
  12055. -{
  12056. -  struct sock *sk;
  12057. -
  12058. -  sk = (struct sock *) sock->data;
  12059. -  if (sk == NULL) {
  12060. -    printk("Warning: sock->data = NULL: %d\n" ,__LINE__);
  12061. -    return(0);
  12062. -  }
  12063. -
  12064. -  /* We may need to bind the socket. */
  12065. -  if (sk->num == 0) {
  12066. -    sk->num = get_new_socknum(sk->prot, 0);
  12067. -    if (sk->num == 0) return(-EAGAIN);
  12068. -    put_sock(sk->num, sk);
  12069. -    sk->dummy_th.source = ntohs(sk->num);
  12070. -  }
  12071. -
  12072. -  /* We might as well re use these. */ 
  12073. -  sk->max_ack_backlog = backlog;
  12074. -  if (sk->state != TCP_LISTEN) {
  12075. -    sk->ack_backlog = 0;
  12076. -    sk->state = TCP_LISTEN;
  12077. -  }
  12078. -  return(0);
  12079. -}
  12080. -
  12081. -/*
  12082. - *    Default callbacks for user INET sockets. These just wake up
  12083. - *    the user owning the socket.
  12084. - */
  12085. -
  12086. -static void def_callback1(struct sock *sk)
  12087. -{
  12088. -    if(!sk->dead)
  12089. -        wake_up_interruptible(sk->sleep);
  12090. -}
  12091. -
  12092. -static void def_callback2(struct sock *sk,int len)
  12093. -{
  12094. -    if(!sk->dead)
  12095. -        wake_up_interruptible(sk->sleep);
  12096. -}
  12097. -
  12098. -
  12099. -static int
  12100. -inet_create(struct socket *sock, int protocol)
  12101. -{
  12102. -  struct sock *sk;
  12103. -  struct proto *prot;
  12104. -  int err;
  12105. -
  12106. -  sk = (struct sock *) kmalloc(sizeof(*sk), GFP_KERNEL);
  12107. -  if (sk == NULL) 
  12108. -      return(-ENOMEM);
  12109. -  sk->num = 0;
  12110. -  sk->reuse = 0;
  12111. -  switch(sock->type) {
  12112. -    case SOCK_STREAM:
  12113. -    case SOCK_SEQPACKET:
  12114. -        if (protocol && protocol != IPPROTO_TCP) {
  12115. -            kfree_s((void *)sk, sizeof(*sk));
  12116. -            return(-EPROTONOSUPPORT);
  12117. -        }
  12118. -        protocol = IPPROTO_TCP;
  12119. -        sk->no_check = TCP_NO_CHECK;
  12120. -        prot = &tcp_prot;
  12121. -        break;
  12122. -
  12123. -    case SOCK_DGRAM:
  12124. -        if (protocol && protocol != IPPROTO_UDP) {
  12125. -            kfree_s((void *)sk, sizeof(*sk));
  12126. -            return(-EPROTONOSUPPORT);
  12127. -        }
  12128. -        protocol = IPPROTO_UDP;
  12129. -        sk->no_check = UDP_NO_CHECK;
  12130. -        prot=&udp_prot;
  12131. -        break;
  12132. -      
  12133. -    case SOCK_RAW:
  12134. -        if (!suser()) {
  12135. -            kfree_s((void *)sk, sizeof(*sk));
  12136. -            return(-EPERM);
  12137. -        }
  12138. -        if (!protocol) {
  12139. -            kfree_s((void *)sk, sizeof(*sk));
  12140. -            return(-EPROTONOSUPPORT);
  12141. -        }
  12142. -        prot = &raw_prot;
  12143. -        sk->reuse = 1;
  12144. -        sk->no_check = 0;    /*
  12145. -                     * Doesn't matter no checksum is
  12146. -                     * preformed anyway.
  12147. -                     */
  12148. -        sk->num = protocol;
  12149. -        break;
  12150. -
  12151. -    case SOCK_PACKET:
  12152. -        if (!suser()) {
  12153. -            kfree_s((void *)sk, sizeof(*sk));
  12154. -            return(-EPERM);
  12155. -        }
  12156. -        if (!protocol) {
  12157. -            kfree_s((void *)sk, sizeof(*sk));
  12158. -            return(-EPROTONOSUPPORT);
  12159. -        }
  12160. -        prot = &packet_prot;
  12161. -        sk->reuse = 1;
  12162. -        sk->no_check = 0;    /* Doesn't matter no checksum is
  12163. -                     * preformed anyway.
  12164. -                     */
  12165. -        sk->num = protocol;
  12166. -        break;
  12167. -
  12168. -    default:
  12169. -        kfree_s((void *)sk, sizeof(*sk));
  12170. -        return(-ESOCKTNOSUPPORT);
  12171. -  }
  12172. -  sk->socket = sock;
  12173. -#ifdef CONFIG_TCP_NAGLE_OFF
  12174. -  sk->nonagle = 1;
  12175. -#else    
  12176. -  sk->nonagle = 0;
  12177. -#endif  
  12178. -  sk->type = sock->type;
  12179. -  sk->stamp.tv_sec=0;
  12180. -  sk->protocol = protocol;
  12181. -  sk->wmem_alloc = 0;
  12182. -  sk->rmem_alloc = 0;
  12183. -  sk->sndbuf = SK_WMEM_MAX;
  12184. -  sk->rcvbuf = SK_RMEM_MAX;
  12185. -  sk->pair = NULL;
  12186. -  sk->opt = NULL;
  12187. -  sk->write_seq = 0;
  12188. -  sk->acked_seq = 0;
  12189. -  sk->copied_seq = 0;
  12190. -  sk->fin_seq = 0;
  12191. -  sk->urg_seq = 0;
  12192. -  sk->urg_data = 0;
  12193. -  sk->proc = 0;
  12194. -  sk->rtt = TCP_WRITE_TIME << 3;
  12195. -  sk->rto = TCP_WRITE_TIME;
  12196. -  sk->mdev = 0;
  12197. -  sk->backoff = 0;
  12198. -  sk->packets_out = 0;
  12199. -  sk->cong_window = 1; /* start with only sending one packet at a time. */
  12200. -  sk->cong_count = 0;
  12201. -  sk->ssthresh = 0;
  12202. -  sk->max_window = 0;
  12203. -  sk->urginline = 0;
  12204. -  sk->intr = 0;
  12205. -  sk->linger = 0;
  12206. -  sk->destroy = 0;
  12207. -
  12208. -  sk->priority = 1;
  12209. -  sk->shutdown = 0;
  12210. -  sk->keepopen = 0;
  12211. -  sk->zapped = 0;
  12212. -  sk->done = 0;
  12213. -  sk->ack_backlog = 0;
  12214. -  sk->window = 0;
  12215. -  sk->bytes_rcv = 0;
  12216. -  sk->state = TCP_CLOSE;
  12217. -  sk->dead = 0;
  12218. -  sk->ack_timed = 0;
  12219. -  sk->partial = NULL;
  12220. -  sk->user_mss = 0;
  12221. -  sk->debug = 0;
  12222. -
  12223. -  /* this is how many unacked bytes we will accept for this socket.  */
  12224. -  sk->max_unacked = 2048; /* needs to be at most 2 full packets. */
  12225. -
  12226. -  /* how many packets we should send before forcing an ack. 
  12227. -     if this is set to zero it is the same as sk->delay_acks = 0 */
  12228. -  sk->max_ack_backlog = 0;
  12229. -  sk->inuse = 0;
  12230. -  sk->delay_acks = 0;
  12231. -  skb_queue_head_init(&sk->write_queue);
  12232. -  skb_queue_head_init(&sk->receive_queue);
  12233. -  sk->mtu = 576;
  12234. -  sk->prot = prot;
  12235. -  sk->sleep = sock->wait;
  12236. -  sk->daddr = 0;
  12237. -  sk->saddr = ip_my_addr();
  12238. -  sk->err = 0;
  12239. -  sk->next = NULL;
  12240. -  sk->pair = NULL;
  12241. -  sk->send_tail = NULL;
  12242. -  sk->send_head = NULL;
  12243. -  sk->timeout = 0;
  12244. -  sk->broadcast = 0;
  12245. -  sk->localroute = 0;
  12246. -  sk->timer.data = (unsigned long)sk;
  12247. -  sk->timer.function = &net_timer;
  12248. -  skb_queue_head_init(&sk->back_log);
  12249. -  sk->blog = 0;
  12250. -  sock->data =(void *) sk;
  12251. -  sk->dummy_th.doff = sizeof(sk->dummy_th)/4;
  12252. -  sk->dummy_th.res1=0;
  12253. -  sk->dummy_th.res2=0;
  12254. -  sk->dummy_th.urg_ptr = 0;
  12255. -  sk->dummy_th.fin = 0;
  12256. -  sk->dummy_th.syn = 0;
  12257. -  sk->dummy_th.rst = 0;
  12258. -  sk->dummy_th.psh = 0;
  12259. -  sk->dummy_th.ack = 0;
  12260. -  sk->dummy_th.urg = 0;
  12261. -  sk->dummy_th.dest = 0;
  12262. -
  12263. -  sk->ip_tos=0;
  12264. -  sk->ip_ttl=64;
  12265. -      
  12266. -  sk->state_change = def_callback1;
  12267. -  sk->data_ready = def_callback2;
  12268. -  sk->write_space = def_callback1;
  12269. -  sk->error_report = def_callback1;
  12270. -
  12271. -  if (sk->num) {
  12272. -    /*
  12273. -     * It assumes that any protocol which allows
  12274. -     * the user to assign a number at socket
  12275. -     * creation time automatically
  12276. -     * shares.
  12277. -     */
  12278. -    put_sock(sk->num, sk);
  12279. -    sk->dummy_th.source = ntohs(sk->num);
  12280. -  }
  12281. -
  12282. -  if (sk->prot->init) {
  12283. -    err = sk->prot->init(sk);
  12284. -    if (err != 0) {
  12285. -        destroy_sock(sk);
  12286. -        return(err);
  12287. -    }
  12288. -  }
  12289. -  return(0);
  12290. -}
  12291. -
  12292. -
  12293. -static int
  12294. -inet_dup(struct socket *newsock, struct socket *oldsock)
  12295. -{
  12296. -  return(inet_create(newsock,
  12297. -           ((struct sock *)(oldsock->data))->protocol));
  12298. -}
  12299. -
  12300. -
  12301. -/* The peer socket should always be NULL. */
  12302. -static int
  12303. -inet_release(struct socket *sock, struct socket *peer)
  12304. -{
  12305. -  struct sock *sk;
  12306. -
  12307. -  sk = (struct sock *) sock->data;
  12308. -  if (sk == NULL) return(0);
  12309. -
  12310. -  DPRINTF((DBG_INET, "inet_release(sock = %X, peer = %X)\n", sock, peer));
  12311. -  sk->state_change(sk);
  12312. -
  12313. -  /* Start closing the connection.  This may take a while. */
  12314. -  /*
  12315. -   * If linger is set, we don't return until the close
  12316. -   * is complete.  Other wise we return immediately. The
  12317. -   * actually closing is done the same either way.
  12318. -   */
  12319. -  if (sk->linger == 0) {
  12320. -    sk->prot->close(sk,0);
  12321. -    sk->dead = 1;
  12322. -  } else {
  12323. -    DPRINTF((DBG_INET, "sk->linger set.\n"));
  12324. -    sk->prot->close(sk, 0);
  12325. -    cli();
  12326. -    if (sk->lingertime)
  12327. -        current->timeout = jiffies + HZ*sk->lingertime;
  12328. -    while(sk->state != TCP_CLOSE && current->timeout>0) {
  12329. -        interruptible_sleep_on(sk->sleep);
  12330. -        if (current->signal & ~current->blocked) {
  12331. -            break;
  12332. -#if 0
  12333. -            /* not working now - closes can't be restarted */
  12334. -            sti();
  12335. -            current->timeout=0;
  12336. -            return(-ERESTARTSYS);
  12337. -#endif
  12338. -        }
  12339. -    }
  12340. -    current->timeout=0;
  12341. -    sti();
  12342. -    sk->dead = 1;
  12343. -  }
  12344. -  sk->inuse = 1;
  12345. -
  12346. -  /* This will destroy it. */
  12347. -  release_sock(sk);
  12348. -  sock->data = NULL;
  12349. -  DPRINTF((DBG_INET, "inet_release returning\n"));
  12350. -  return(0);
  12351. -}
  12352. -
  12353. -
  12354. -/* this needs to be changed to dissallow
  12355. -   the rebinding of sockets.   What error
  12356. -   should it return? */
  12357. -
  12358. -static int
  12359. -inet_bind(struct socket *sock, struct sockaddr *uaddr,
  12360. -           int addr_len)
  12361. -{
  12362. -  struct sockaddr_in addr;
  12363. -  struct sock *sk, *sk2;
  12364. -  unsigned short snum;
  12365. -  int err;
  12366. -  int chk_addr_ret;
  12367. -
  12368. -  sk = (struct sock *) sock->data;
  12369. -  /* check this error. */
  12370. -  if (sk->state != TCP_CLOSE) return(-EIO);
  12371. -  if (sk->num != 0) return(-EINVAL);
  12372. -
  12373. -  err=verify_area(VERIFY_READ, uaddr, addr_len);
  12374. -  if(err)
  12375. -      return err;
  12376. -  memcpy_fromfs(&addr, uaddr, min(sizeof(addr), addr_len));
  12377. -
  12378. -  snum = ntohs(addr.sin_port);
  12379. -  DPRINTF((DBG_INET, "bind sk =%X to port = %d\n", sk, snum));
  12380. -  sk = (struct sock *) sock->data;
  12381. -
  12382. -  /*
  12383. -   * We can't just leave the socket bound wherever it is, it might
  12384. -   * be bound to a privileged port. However, since there seems to
  12385. -   * be a bug here, we will leave it if the port is not privileged.
  12386. -   */
  12387. -  if (snum == 0) {
  12388. -    snum = get_new_socknum(sk->prot, 0);
  12389. -  }
  12390. -  if (snum < PROT_SOCK && !suser()) return(-EACCES);
  12391. -
  12392. -  chk_addr_ret = ip_chk_addr(addr.sin_addr.s_addr);
  12393. -  if (addr.sin_addr.s_addr != 0 && chk_addr_ret != IS_MYADDR)
  12394. -      return(-EADDRNOTAVAIL);    /* Source address MUST be ours! */
  12395. -      
  12396. -  if (chk_addr_ret || addr.sin_addr.s_addr == 0)
  12397. -                    sk->saddr = addr.sin_addr.s_addr;
  12398. -
  12399. -  DPRINTF((DBG_INET, "sock_array[%d] = %X:\n", snum &(SOCK_ARRAY_SIZE -1),
  12400. -              sk->prot->sock_array[snum &(SOCK_ARRAY_SIZE -1)]));
  12401. -
  12402. -  /* Make sure we are allowed to bind here. */
  12403. -  cli();
  12404. -outside_loop:
  12405. -  for(sk2 = sk->prot->sock_array[snum & (SOCK_ARRAY_SIZE -1)];
  12406. -                    sk2 != NULL; sk2 = sk2->next) {
  12407. -#if     1    /* should be below! */
  12408. -    if (sk2->num != snum) continue;
  12409. -/*    if (sk2->saddr != sk->saddr) continue; */
  12410. -#endif
  12411. -    if (sk2->dead) {
  12412. -        destroy_sock(sk2);
  12413. -        goto outside_loop;
  12414. -    }
  12415. -    if (!sk->reuse) {
  12416. -        sti();
  12417. -        return(-EADDRINUSE);
  12418. -    }
  12419. -    if (sk2->num != snum) continue;        /* more than one */
  12420. -    if (sk2->saddr != sk->saddr) continue;    /* socket per slot ! -FB */
  12421. -    if (!sk2->reuse) {
  12422. -        sti();
  12423. -        return(-EADDRINUSE);
  12424. -    }
  12425. -  }
  12426. -  sti();
  12427. -
  12428. -  remove_sock(sk);
  12429. -  put_sock(snum, sk);
  12430. -  sk->dummy_th.source = ntohs(sk->num);
  12431. -  sk->daddr = 0;
  12432. -  sk->dummy_th.dest = 0;
  12433. -  return(0);
  12434. -}
  12435. -
  12436. -
  12437. -static int
  12438. -inet_connect(struct socket *sock, struct sockaddr * uaddr,
  12439. -          int addr_len, int flags)
  12440. -{
  12441. -  struct sock *sk;
  12442. -  int err;
  12443. -
  12444. -  sock->conn = NULL;
  12445. -  sk = (struct sock *) sock->data;
  12446. -
  12447. -  if (sock->state == SS_CONNECTING && sk->state == TCP_ESTABLISHED)
  12448. -  {
  12449. -    sock->state = SS_CONNECTED;
  12450. -  /* Connection completing after a connect/EINPROGRESS/select/connect */
  12451. -    return 0;    /* Rock and roll */
  12452. -  }
  12453. -
  12454. -  if (sock->state == SS_CONNECTING && sk->protocol == IPPROTO_TCP &&
  12455. -      (flags & O_NONBLOCK))
  12456. -      return -EALREADY;    /* Connecting is currently in progress */
  12457. -      
  12458. -  if (sock->state != SS_CONNECTING) {
  12459. -    /* We may need to bind the socket. */
  12460. -    if (sk->num == 0) {
  12461. -        sk->num = get_new_socknum(sk->prot, 0);
  12462. -        if (sk->num == 0) 
  12463. -            return(-EAGAIN);
  12464. -        put_sock(sk->num, sk);
  12465. -        sk->dummy_th.source = htons(sk->num);
  12466. -    }
  12467. -
  12468. -    if (sk->prot->connect == NULL) 
  12469. -        return(-EOPNOTSUPP);
  12470. -  
  12471. -    err = sk->prot->connect(sk, (struct sockaddr_in *)uaddr, addr_len);
  12472. -    if (err < 0) return(err);
  12473. -  
  12474. -    sock->state = SS_CONNECTING;
  12475. -  }
  12476. -
  12477. -  if (sk->state != TCP_ESTABLISHED &&(flags & O_NONBLOCK)) 
  12478. -      return(-EINPROGRESS);
  12479. -
  12480. -  cli(); /* avoid the race condition */
  12481. -  while(sk->state == TCP_SYN_SENT || sk->state == TCP_SYN_RECV) 
  12482. -  {
  12483. -    interruptible_sleep_on(sk->sleep);
  12484. -    if (current->signal & ~current->blocked) {
  12485. -        sti();
  12486. -        return(-ERESTARTSYS);
  12487. -    }
  12488. -    /* This fixes a nasty in the tcp/ip code. There is a hideous hassle with
  12489. -       icmp error packets wanting to close a tcp or udp socket. */
  12490. -    if(sk->err && sk->protocol == IPPROTO_TCP)
  12491. -    {
  12492. -        sti();
  12493. -        sock->state = SS_UNCONNECTED;
  12494. -        err = -sk->err;
  12495. -        sk->err=0;
  12496. -        return err; /* set by tcp_err() */
  12497. -    }
  12498. -  }
  12499. -  sti();
  12500. -  sock->state = SS_CONNECTED;
  12501. -
  12502. -  if (sk->state != TCP_ESTABLISHED && sk->err) {
  12503. -    sock->state = SS_UNCONNECTED;
  12504. -    err=sk->err;
  12505. -    sk->err=0;
  12506. -    return(-err);
  12507. -  }
  12508. -  return(0);
  12509. -}
  12510. -
  12511. -
  12512. -static int
  12513. -inet_socketpair(struct socket *sock1, struct socket *sock2)
  12514. -{
  12515. -  return(-EOPNOTSUPP);
  12516. -}
  12517. -
  12518. -
  12519. -static int
  12520. -inet_accept(struct socket *sock, struct socket *newsock, int flags)
  12521. -{
  12522. -  struct sock *sk1, *sk2;
  12523. -  int err;
  12524. -
  12525. -  sk1 = (struct sock *) sock->data;
  12526. -
  12527. -  /*
  12528. -   * We've been passed an extra socket.
  12529. -   * We need to free it up because the tcp module creates
  12530. -   * it's own when it accepts one.
  12531. -   */
  12532. -  if (newsock->data)
  12533. -  {
  12534. -      struct sock *sk=(struct sock *)newsock->data;
  12535. -      newsock->data=NULL;
  12536. -      sk->dead = 1;
  12537. -      destroy_sock(sk);
  12538. -  }
  12539. -  
  12540. -  if (sk1->prot->accept == NULL) return(-EOPNOTSUPP);
  12541. -
  12542. -  /* Restore the state if we have been interrupted, and then returned. */
  12543. -  if (sk1->pair != NULL ) {
  12544. -    sk2 = sk1->pair;
  12545. -    sk1->pair = NULL;
  12546. -  } else {
  12547. -    sk2 = sk1->prot->accept(sk1,flags);
  12548. -    if (sk2 == NULL) {
  12549. -        if (sk1->err <= 0)
  12550. -            printk("Warning sock.c:sk1->err <= 0.  Returning non-error.\n");
  12551. -        err=sk1->err;
  12552. -        sk1->err=0;
  12553. -        return(-err);
  12554. -    }
  12555. -  }
  12556. -  newsock->data = (void *)sk2;
  12557. -  sk2->sleep = newsock->wait;
  12558. -  newsock->conn = NULL;
  12559. -  if (flags & O_NONBLOCK) return(0);
  12560. -
  12561. -  cli(); /* avoid the race. */
  12562. -  while(sk2->state == TCP_SYN_RECV) {
  12563. -    interruptible_sleep_on(sk2->sleep);
  12564. -    if (current->signal & ~current->blocked) {
  12565. -        sti();
  12566. -        sk1->pair = sk2;
  12567. -        sk2->sleep = NULL;
  12568. -        newsock->data = NULL;
  12569. -        return(-ERESTARTSYS);
  12570. -    }
  12571. -  }
  12572. -  sti();
  12573. -
  12574. -  if (sk2->state != TCP_ESTABLISHED && sk2->err > 0) {
  12575. -
  12576. -    err = -sk2->err;
  12577. -    sk2->err=0;
  12578. -    destroy_sock(sk2);
  12579. -    newsock->data = NULL;
  12580. -    return(err);
  12581. -  }
  12582. -  newsock->state = SS_CONNECTED;
  12583. -  return(0);
  12584. -}
  12585. -
  12586. -
  12587. -static int
  12588. -inet_getname(struct socket *sock, struct sockaddr *uaddr,
  12589. -         int *uaddr_len, int peer)
  12590. -{
  12591. -  struct sockaddr_in sin;
  12592. -  struct sock *sk;
  12593. -  int len;
  12594. -  int err;
  12595. -  
  12596. -  
  12597. -  err = verify_area(VERIFY_WRITE,uaddr_len,sizeof(long));
  12598. -  if(err)
  12599. -      return err;
  12600. -      
  12601. -  len=get_fs_long(uaddr_len);
  12602. -  
  12603. -  err = verify_area(VERIFY_WRITE, uaddr, len);
  12604. -  if(err)
  12605. -      return err;
  12606. -      
  12607. -  /* Check this error. */
  12608. -  if (len < sizeof(sin)) return(-EINVAL);
  12609. -
  12610. -  sin.sin_family = AF_INET;
  12611. -  sk = (struct sock *) sock->data;
  12612. -  if (sk == NULL) {
  12613. -    printk("Warning: sock->data = NULL: %d\n" ,__LINE__);
  12614. -    return(0);
  12615. -  }
  12616. -  if (peer) {
  12617. -    if (!tcp_connected(sk->state)) return(-ENOTCONN);
  12618. -    sin.sin_port = sk->dummy_th.dest;
  12619. -    sin.sin_addr.s_addr = sk->daddr;
  12620. -  } else {
  12621. -    sin.sin_port = sk->dummy_th.source;
  12622. -    if (sk->saddr == 0) sin.sin_addr.s_addr = ip_my_addr();
  12623. -      else sin.sin_addr.s_addr = sk->saddr;
  12624. -  }
  12625. -  len = sizeof(sin);
  12626. -/*  verify_area(VERIFY_WRITE, uaddr, len); NOW DONE ABOVE */
  12627. -  memcpy_tofs(uaddr, &sin, sizeof(sin));
  12628. -/*  verify_area(VERIFY_WRITE, uaddr_len, sizeof(len)); NOW DONE ABOVE */
  12629. -  put_fs_long(len, uaddr_len);
  12630. -  return(0);
  12631. -}
  12632. -
  12633. -
  12634. -static int
  12635. -inet_read(struct socket *sock, char *ubuf, int size, int noblock)
  12636. -{
  12637. -  struct sock *sk;
  12638. -
  12639. -  sk = (struct sock *) sock->data;
  12640. -
  12641. -  /* We may need to bind the socket. */
  12642. -  if (sk->num == 0) {
  12643. -    sk->num = get_new_socknum(sk->prot, 0);
  12644. -    if (sk->num == 0) return(-EAGAIN);
  12645. -    put_sock(sk->num, sk);
  12646. -    sk->dummy_th.source = ntohs(sk->num);
  12647. -  }
  12648. -  return(sk->prot->read(sk, (unsigned char *) ubuf, size, noblock,0));
  12649. -}
  12650. -
  12651. -
  12652. -static int
  12653. -inet_recv(struct socket *sock, void *ubuf, int size, int noblock,
  12654. -      unsigned flags)
  12655. -{
  12656. -  struct sock *sk;
  12657. -
  12658. -  sk = (struct sock *) sock->data;
  12659. -
  12660. -  /* We may need to bind the socket. */
  12661. -  if (sk->num == 0) {
  12662. -    sk->num = get_new_socknum(sk->prot, 0);
  12663. -    if (sk->num == 0) return(-EAGAIN);
  12664. -    put_sock(sk->num, sk);
  12665. -    sk->dummy_th.source = ntohs(sk->num);
  12666. -  }
  12667. -  return(sk->prot->read(sk, (unsigned char *) ubuf, size, noblock, flags));
  12668. -}
  12669. -
  12670. -
  12671. -static int
  12672. -inet_write(struct socket *sock, char *ubuf, int size, int noblock)
  12673. -{
  12674. -  struct sock *sk;
  12675. -
  12676. -  sk = (struct sock *) sock->data;
  12677. -  if (sk->shutdown & SEND_SHUTDOWN) {
  12678. -    send_sig(SIGPIPE, current, 1);
  12679. -    return(-EPIPE);
  12680. -  }
  12681. -
  12682. -  /* We may need to bind the socket. */
  12683. -  if (sk->num == 0) {
  12684. -    sk->num = get_new_socknum(sk->prot, 0);
  12685. -    if (sk->num == 0) return(-EAGAIN);
  12686. -    put_sock(sk->num, sk);
  12687. -    sk->dummy_th.source = ntohs(sk->num);
  12688. -  }
  12689. -
  12690. -  return(sk->prot->write(sk, (unsigned char *) ubuf, size, noblock, 0));
  12691. -}
  12692. -
  12693. -
  12694. -static int
  12695. -inet_send(struct socket *sock, void *ubuf, int size, int noblock, 
  12696. -           unsigned flags)
  12697. -{
  12698. -  struct sock *sk;
  12699. -
  12700. -  sk = (struct sock *) sock->data;
  12701. -  if (sk->shutdown & SEND_SHUTDOWN) {
  12702. -    send_sig(SIGPIPE, current, 1);
  12703. -    return(-EPIPE);
  12704. -  }
  12705. -
  12706. -  /* We may need to bind the socket. */
  12707. -  if (sk->num == 0) {
  12708. -    sk->num = get_new_socknum(sk->prot, 0);
  12709. -    if (sk->num == 0) return(-EAGAIN);
  12710. -    put_sock(sk->num, sk);
  12711. -    sk->dummy_th.source = ntohs(sk->num);
  12712. -  }
  12713. -
  12714. -  return(sk->prot->write(sk, (unsigned char *) ubuf, size, noblock, flags));
  12715. -}
  12716. -
  12717. -
  12718. -static int
  12719. -inet_sendto(struct socket *sock, void *ubuf, int size, int noblock, 
  12720. -        unsigned flags, struct sockaddr *sin, int addr_len)
  12721. -{
  12722. -  struct sock *sk;
  12723. -
  12724. -  sk = (struct sock *) sock->data;
  12725. -  if (sk->shutdown & SEND_SHUTDOWN) {
  12726. -    send_sig(SIGPIPE, current, 1);
  12727. -    return(-EPIPE);
  12728. -  }
  12729. -
  12730. -  if (sk->prot->sendto == NULL) return(-EOPNOTSUPP);
  12731. -
  12732. -  /* We may need to bind the socket. */
  12733. -  if (sk->num == 0) {
  12734. -    sk->num = get_new_socknum(sk->prot, 0);
  12735. -    if (sk->num == 0) return(-EAGAIN);
  12736. -    put_sock(sk->num, sk);
  12737. -    sk->dummy_th.source = ntohs(sk->num);
  12738. -  }
  12739. -
  12740. -  return(sk->prot->sendto(sk, (unsigned char *) ubuf, size, noblock, flags, 
  12741. -               (struct sockaddr_in *)sin, addr_len));
  12742. -}
  12743. -
  12744. -
  12745. -static int
  12746. -inet_recvfrom(struct socket *sock, void *ubuf, int size, int noblock, 
  12747. -           unsigned flags, struct sockaddr *sin, int *addr_len )
  12748. -{
  12749. -  struct sock *sk;
  12750. -
  12751. -  sk = (struct sock *) sock->data;
  12752. -
  12753. -  if (sk->prot->recvfrom == NULL) return(-EOPNOTSUPP);
  12754. -
  12755. -  /* We may need to bind the socket. */
  12756. -  if (sk->num == 0) {
  12757. -    sk->num = get_new_socknum(sk->prot, 0);
  12758. -    if (sk->num == 0) return(-EAGAIN);
  12759. -    put_sock(sk->num, sk);
  12760. -    sk->dummy_th.source = ntohs(sk->num);
  12761. -  }
  12762. -
  12763. -  return(sk->prot->recvfrom(sk, (unsigned char *) ubuf, size, noblock, flags,
  12764. -                 (struct sockaddr_in*)sin, addr_len));
  12765. -}
  12766. -
  12767. -
  12768. -static int
  12769. -inet_shutdown(struct socket *sock, int how)
  12770. -{
  12771. -  struct sock *sk;
  12772. -
  12773. -  /*
  12774. -   * This should really check to make sure
  12775. -   * the socket is a TCP socket.
  12776. -   */
  12777. -  how++; /* maps 0->1 has the advantage of making bit 1 rcvs and
  12778. -               1->2 bit 2 snds.
  12779. -               2->3 */
  12780. -  if (how & ~SHUTDOWN_MASK) return(-EINVAL);
  12781. -  sk = (struct sock *) sock->data;
  12782. -  if (sk == NULL) {
  12783. -    printk("Warning: sock->data = NULL: %d\n" ,__LINE__);
  12784. -    return(0);
  12785. -  }
  12786. -  if (sock->state == SS_CONNECTING && sk->state == TCP_ESTABLISHED)
  12787. -                        sock->state = SS_CONNECTED;
  12788. -
  12789. -  if (!tcp_connected(sk->state)) return(-ENOTCONN);
  12790. -  sk->shutdown |= how;
  12791. -  if (sk->prot->shutdown) sk->prot->shutdown(sk, how);
  12792. -  return(0);
  12793. -}
  12794. -
  12795. -
  12796. -static int
  12797. -inet_select(struct socket *sock, int sel_type, select_table *wait )
  12798. -{
  12799. -  struct sock *sk;
  12800. -
  12801. -  sk = (struct sock *) sock->data;
  12802. -
  12803. -  if (sk->prot->select == NULL) {
  12804. -    DPRINTF((DBG_INET, "select on non-selectable socket.\n"));
  12805. -    return(0);
  12806. -  }
  12807. -  return(sk->prot->select(sk, sel_type, wait));
  12808. -}
  12809. -
  12810. -
  12811. -static int
  12812. -inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
  12813. -{
  12814. -  struct sock *sk;
  12815. -  int err;
  12816. -
  12817. -  DPRINTF((DBG_INET, "INET: in inet_ioctl\n"));
  12818. -  sk = NULL;
  12819. -  if (sock && (sk = (struct sock *) sock->data) == NULL) {
  12820. -    printk("AF_INET: Warning: sock->data = NULL: %d\n" , __LINE__);
  12821. -    return(0);
  12822. -  }
  12823. -
  12824. -  switch(cmd) {
  12825. -    case FIOSETOWN:
  12826. -    case SIOCSPGRP:
  12827. -        err=verify_area(VERIFY_READ,(int *)arg,sizeof(long));
  12828. -        if(err)
  12829. -            return err;
  12830. -        if (sk)
  12831. -            sk->proc = get_fs_long((int *) arg);
  12832. -        return(0);
  12833. -    case FIOGETOWN:
  12834. -    case SIOCGPGRP:
  12835. -        if (sk) {
  12836. -            err=verify_area(VERIFY_WRITE,(void *) arg, sizeof(long));
  12837. -            if(err)
  12838. -                return err;
  12839. -            put_fs_long(sk->proc,(int *)arg);
  12840. -        }
  12841. -        return(0);
  12842. -        
  12843. -    case SIOCGSTAMP:
  12844. -        if (sk)
  12845. -        {
  12846. -            if(sk->stamp.tv_sec==0)
  12847. -                return -ENOENT;
  12848. -            err=verify_area(VERIFY_WRITE,(void *)arg,sizeof(struct timeval));
  12849. -            if(err)
  12850. -                return err;
  12851. -            memcpy_tofs((void *)arg,&sk->stamp,sizeof(struct timeval));
  12852. -            return 0;
  12853. -        }
  12854. -        return -EINVAL;
  12855. -        
  12856. -#if 0    /* FIXME: */
  12857. -    case SIOCATMARK:
  12858. -        printk("AF_INET: ioctl(SIOCATMARK, 0x%08X)\n",(void *) arg);
  12859. -        return(-EINVAL);
  12860. -#endif
  12861. -
  12862. -    case DDIOCSDBG:
  12863. -        return(dbg_ioctl((void *) arg, DBG_INET));
  12864. -
  12865. -    case SIOCADDRT: case SIOCADDRTOLD:
  12866. -    case SIOCDELRT: case SIOCDELRTOLD:
  12867. -        return(ip_rt_ioctl(cmd,(void *) arg));
  12868. -
  12869. -    case SIOCDARP:
  12870. -    case SIOCGARP:
  12871. -    case SIOCSARP:
  12872. -        return(arp_ioctl(cmd,(void *) arg));
  12873. -
  12874. -    case SIOCDRARP:
  12875. -    case SIOCGRARP:
  12876. -    case SIOCSRARP:
  12877. -        return(rarp_ioctl(cmd,(void *) arg));
  12878. -
  12879. -    case SIOCGIFCONF:
  12880. -    case SIOCGIFFLAGS:
  12881. -    case SIOCSIFFLAGS:
  12882. -    case SIOCGIFADDR:
  12883. -    case SIOCSIFADDR:
  12884. -    case SIOCGIFDSTADDR:
  12885. -    case SIOCSIFDSTADDR:
  12886. -    case SIOCGIFBRDADDR:
  12887. -    case SIOCSIFBRDADDR:
  12888. -    case SIOCGIFNETMASK:
  12889. -    case SIOCSIFNETMASK:
  12890. -    case SIOCGIFMETRIC:
  12891. -    case SIOCSIFMETRIC:
  12892. -    case SIOCGIFMEM:
  12893. -    case SIOCSIFMEM:
  12894. -    case SIOCGIFMTU:
  12895. -    case SIOCSIFMTU:
  12896. -    case SIOCSIFLINK:
  12897. -    case SIOCGIFHWADDR:
  12898. -    case SIOCSIFHWADDR:
  12899. -    case OLD_SIOCGIFHWADDR:
  12900. -        return(dev_ioctl(cmd,(void *) arg));
  12901. -
  12902. -    default:
  12903. -        if (!sk || !sk->prot->ioctl) return(-EINVAL);
  12904. -        return(sk->prot->ioctl(sk, cmd, arg));
  12905. -  }
  12906. -  /*NOTREACHED*/
  12907. -  return(0);
  12908. -}
  12909. -
  12910. -
  12911.  struct sk_buff *
  12912.  sock_wmalloc(struct sock *sk, unsigned long size, int force,
  12913.           int priority)
  12914. @@ -1535,8 +321,6 @@
  12915.          }
  12916.          return c;
  12917.      }
  12918. -    DPRINTF((DBG_INET, "sock_wmalloc(%X,%d,%d,%d) returning NULL\n",
  12919. -                        sk, size, force, priority));
  12920.      return(NULL);
  12921.    }
  12922.    return(alloc_skb(size, priority));
  12923. @@ -1556,8 +340,6 @@
  12924.          }
  12925.          return(c);
  12926.      }
  12927. -    DPRINTF((DBG_INET, "sock_rmalloc(%X,%d,%d,%d) returning NULL\n",
  12928. -                        sk,size,force, priority));
  12929.      return(NULL);
  12930.    }
  12931.    return(alloc_skb(size, priority));
  12932. @@ -1594,8 +376,6 @@
  12933.  void
  12934.  sock_wfree(struct sock *sk, void *mem, unsigned long size)
  12935.  {
  12936. -  DPRINTF((DBG_INET, "sock_wfree(sk=%X, mem=%X, size=%d)\n", sk, mem, size));
  12937. -
  12938.    IS_SKB(mem);
  12939.    kfree_skbmem(mem, size);
  12940.    if (sk) {
  12941. @@ -1603,10 +383,6 @@
  12942.  
  12943.      /* In case it might be waiting for more memory. */
  12944.      if (!sk->dead) sk->write_space(sk);
  12945. -    if (sk->destroy && sk->wmem_alloc == 0 && sk->rmem_alloc == 0) {
  12946. -        DPRINTF((DBG_INET,
  12947. -            "recovered lost memory, sock = %X\n", sk));
  12948. -    }
  12949.      return;
  12950.    }
  12951.  }
  12952. @@ -1615,60 +391,11 @@
  12953.  void
  12954.  sock_rfree(struct sock *sk, void *mem, unsigned long size)
  12955.  {
  12956. -  DPRINTF((DBG_INET, "sock_rfree(sk=%X, mem=%X, size=%d)\n", sk, mem, size));
  12957.    IS_SKB(mem);
  12958.    kfree_skbmem(mem, size);
  12959.    if (sk) {
  12960.      sk->rmem_alloc -= size;
  12961. -    if (sk->destroy && sk->wmem_alloc == 0 && sk->rmem_alloc == 0) {
  12962. -        DPRINTF((DBG_INET,
  12963. -            "recovered lot memory, sock = %X\n", sk));
  12964. -    }
  12965. -  }
  12966. -}
  12967. -
  12968. -
  12969. -/*
  12970. - * This routine must find a socket given a TCP or UDP header.
  12971. - * Everyhting is assumed to be in net order.
  12972. - */
  12973. -struct sock *get_sock(struct proto *prot, unsigned short num,
  12974. -                unsigned long raddr,
  12975. -                unsigned short rnum, unsigned long laddr)
  12976. -{
  12977. -  struct sock *s;
  12978. -  unsigned short hnum;
  12979. -
  12980. -  hnum = ntohs(num);
  12981. -  DPRINTF((DBG_INET, "get_sock(prot=%X, num=%d, raddr=%X, rnum=%d, laddr=%X)\n",
  12982. -      prot, num, raddr, rnum, laddr));
  12983. -
  12984. -  /*
  12985. -   * SOCK_ARRAY_SIZE must be a power of two.  This will work better
  12986. -   * than a prime unless 3 or more sockets end up using the same
  12987. -   * array entry.  This should not be a problem because most
  12988. -   * well known sockets don't overlap that much, and for
  12989. -   * the other ones, we can just be careful about picking our
  12990. -   * socket number when we choose an arbitrary one.
  12991. -   */
  12992. -  for(s = prot->sock_array[hnum & (SOCK_ARRAY_SIZE - 1)];
  12993. -      s != NULL; s = s->next) 
  12994. -  {
  12995. -    if (s->num != hnum) 
  12996. -        continue;
  12997. -    if(s->dead && (s->state == TCP_CLOSE))
  12998. -        continue;
  12999. -    if(prot == &udp_prot)
  13000. -        return s;
  13001. -    if(ip_addr_match(s->daddr,raddr)==0)
  13002. -        continue;
  13003. -    if (s->dummy_th.dest != rnum && s->dummy_th.dest != 0) 
  13004. -        continue;
  13005. -    if(ip_addr_match(s->saddr,laddr) == 0)
  13006. -        continue;
  13007. -    return(s);
  13008.    }
  13009. -  return(NULL);
  13010.  }
  13011.  
  13012.  
  13013. @@ -1680,170 +407,25 @@
  13014.      return;
  13015.  
  13016.    if (sk->blog) return;
  13017. -
  13018. +#ifdef CONFIG_INET
  13019.    /* See if we have any packets built up. */
  13020.    sk->inuse = 1;
  13021.    while((skb = skb_dequeue(&sk->back_log)) != NULL) {
  13022.      sk->blog = 1;
  13023. -    DPRINTF((DBG_INET, "release_sock: skb = %X:\n", skb));
  13024.      if (sk->prot->rcv) sk->prot->rcv(skb, skb->dev, sk->opt,
  13025.                       skb->saddr, skb->len, skb->daddr, 1,
  13026.                      /* Only used for/by raw sockets. */
  13027.                      (struct inet_protocol *)sk->pair); 
  13028.    }
  13029. +#endif  
  13030.    sk->blog = 0;
  13031.    sk->inuse = 0;
  13032. +#ifdef CONFIG_INET  
  13033.    if (sk->dead && sk->state == TCP_CLOSE) {
  13034.      /* Should be about 2 rtt's */
  13035.      reset_timer(sk, TIME_DONE, min(sk->rtt * 2, TCP_DONE_TIME));
  13036.    }
  13037. -}
  13038. -
  13039. -
  13040. -static int
  13041. -inet_fioctl(struct inode *inode, struct file *file,
  13042. -     unsigned int cmd, unsigned long arg)
  13043. -{
  13044. -  int minor, ret;
  13045. -
  13046. -  /* Extract the minor number on which we work. */
  13047. -  minor = MINOR(inode->i_rdev);
  13048. -
  13049. -  /* Now dispatch on the minor device. */
  13050. -  switch(minor) {
  13051. -    case 0:        /* INET */
  13052. -        ret = inet_ioctl(NULL, cmd, arg);
  13053. -        break;
  13054. -    case 1:        /* IP */
  13055. -        ret = ip_ioctl(NULL, cmd, arg);
  13056. -        break;
  13057. -    case 2:        /* ICMP */
  13058. -        ret = icmp_ioctl(NULL, cmd, arg);
  13059. -        break;
  13060. -    case 3:        /* TCP */
  13061. -        ret = tcp_ioctl(NULL, cmd, arg);
  13062. -        break;
  13063. -    case 4:        /* UDP */
  13064. -        ret = udp_ioctl(NULL, cmd, arg);
  13065. -        break;
  13066. -    default:
  13067. -        ret = -ENODEV;
  13068. -  }
  13069. -
  13070. -  return(ret);
  13071. +#endif  
  13072.  }
  13073.  
  13074.  
  13075. -
  13076. -
  13077. -static struct file_operations inet_fops = {
  13078. -  NULL,        /* LSEEK    */
  13079. -  NULL,        /* READ        */
  13080. -  NULL,        /* WRITE    */
  13081. -  NULL,        /* READDIR    */
  13082. -  NULL,        /* SELECT    */
  13083. -  inet_fioctl,    /* IOCTL    */
  13084. -  NULL,        /* MMAP        */
  13085. -  NULL,        /* OPEN        */
  13086. -  NULL        /* CLOSE    */
  13087. -};
  13088. -
  13089. -
  13090. -static struct proto_ops inet_proto_ops = {
  13091. -  AF_INET,
  13092. -
  13093. -  inet_create,
  13094. -  inet_dup,
  13095. -  inet_release,
  13096. -  inet_bind,
  13097. -  inet_connect,
  13098. -  inet_socketpair,
  13099. -  inet_accept,
  13100. -  inet_getname, 
  13101. -  inet_read,
  13102. -  inet_write,
  13103. -  inet_select,
  13104. -  inet_ioctl,
  13105. -  inet_listen,
  13106. -  inet_send,
  13107. -  inet_recv,
  13108. -  inet_sendto,
  13109. -  inet_recvfrom,
  13110. -  inet_shutdown,
  13111. -  inet_setsockopt,
  13112. -  inet_getsockopt,
  13113. -  inet_fcntl,
  13114. -};
  13115. -
  13116. -extern unsigned long seq_offset;
  13117. -
  13118. -/*
  13119. - *    Called by ddi.c on kernel startup.  
  13120. - */
  13121. -void inet_proto_init(struct ddi_proto *pro)
  13122. -{
  13123. -    struct inet_protocol *p;
  13124. -    int i;
  13125. -
  13126. -    printk("Swansea University Computer Society NET3.012\n");
  13127. -    /*
  13128. -     *    Set up our UNIX VFS major device. (compatibility)
  13129. -     */
  13130. -
  13131. -    if (register_chrdev(AF_INET_MAJOR, "af_inet", &inet_fops) < 0) 
  13132. -    {
  13133. -        printk("%s: cannot register major device %d!\n",
  13134. -                    pro->name, AF_INET_MAJOR);
  13135. -        return;
  13136. -    }
  13137. -
  13138. -  /*
  13139. -   *    Tell SOCKET that we are alive... 
  13140. -   */
  13141. -   
  13142. -      (void) sock_register(inet_proto_ops.family, &inet_proto_ops);
  13143. -
  13144. -      seq_offset = CURRENT_TIME*250;
  13145. -
  13146. -    /*
  13147. -     *    Add all the protocols. 
  13148. -     */
  13149. -     
  13150. -    for(i = 0; i < SOCK_ARRAY_SIZE; i++) 
  13151. -    {
  13152. -        tcp_prot.sock_array[i] = NULL;
  13153. -        udp_prot.sock_array[i] = NULL;
  13154. -        raw_prot.sock_array[i] = NULL;
  13155. -      }
  13156. -
  13157. -    printk("IP Protocols: ");
  13158. -    for(p = inet_protocol_base; p != NULL;) 
  13159. -    {
  13160. -        struct inet_protocol *tmp;
  13161. -    
  13162. -        tmp = (struct inet_protocol *) p->next;
  13163. -        inet_add_protocol(p);
  13164. -        printk("%s%s",p->name,tmp?", ":"\n");
  13165. -        p = tmp;
  13166. -    }
  13167. -
  13168. -    /*
  13169. -     *    Initialize the DEV module. 
  13170. -     */     
  13171. -    dev_init();
  13172. -    /*
  13173. -     *    Set the ARP module up
  13174. -     */
  13175. -    arp_init();
  13176. -      /*
  13177. -       *    Set the IP module up
  13178. -       */
  13179. -    ip_init();
  13180. -  
  13181. -    /*
  13182. -     *    Initialize the "Buffer Head" pointers. 
  13183. -     */
  13184. -     
  13185. -    bh_base[INET_BH].routine = inet_bh;
  13186. -}
  13187. Only in linux.old/net/inet: sock.c.orig
  13188. Only in linux.old/net/inet: sock.h.orig
  13189. diff -u --new-file --recursive linux.old/net/inet/tcp.c linux/net/inet/tcp.c
  13190. --- linux.old/net/inet/tcp.c    Fri May 20 18:47:43 1994
  13191. +++ linux/net/inet/tcp.c    Fri May 20 18:50:40 1994
  13192. @@ -69,6 +69,8 @@
  13193.   *                    completely
  13194.   *        Gerhard Koerting:    Fixed some missing timer handling
  13195.   *        Matthew Dillon  :    Reworked TCP machine states as per RFC
  13196. + *        Gerhard Koerting:    PC/TCP workarounds
  13197. + *        Adam Caldwell    :    Assorted timer/timing errors
  13198.   *
  13199.   *
  13200.   * To Fix:
  13201. @@ -135,6 +137,7 @@
  13202.  #include "tcp.h"
  13203.  #include <linux/skbuff.h>
  13204.  #include "sock.h"
  13205. +#include "route.h"
  13206.  #include <linux/errno.h>
  13207.  #include <linux/timer.h>
  13208.  #include <asm/system.h>
  13209. @@ -154,31 +157,6 @@
  13210.  }
  13211.  
  13212.  
  13213. -static void __print_th(struct tcphdr *th)
  13214. -{
  13215. -    unsigned char *ptr;
  13216. -
  13217. -    printk("TCP header:\n");
  13218. -    printk("    source=%d, dest=%d, seq =%ld, ack_seq = %ld\n",
  13219. -        ntohs(th->source), ntohs(th->dest),
  13220. -        ntohl(th->seq), ntohl(th->ack_seq));
  13221. -    printk("    fin=%d, syn=%d, rst=%d, psh=%d, ack=%d, urg=%d res1=%d res2=%d\n",
  13222. -        th->fin, th->syn, th->rst, th->psh, th->ack,
  13223. -        th->urg, th->res1, th->res2);
  13224. -    printk("    window = %d, check = %d urg_ptr = %d\n",
  13225. -        ntohs(th->window), ntohs(th->check), ntohs(th->urg_ptr));
  13226. -    printk("    doff = %d\n", th->doff);
  13227. -    ptr =(unsigned char *)(th + 1);
  13228. -    printk("    options = %d %d %d %d\n", ptr[0], ptr[1], ptr[2], ptr[3]);
  13229. -}
  13230. -
  13231. -static inline void print_th(struct tcphdr *th)
  13232. -{
  13233. -    if (inet_debug == DBG_TCP)
  13234. -        __print_th(th);
  13235. -}
  13236. -
  13237. -
  13238.  /* This routine picks a TCP windows for a socket based on
  13239.     the following constraints
  13240.     
  13241. @@ -197,7 +175,7 @@
  13242.  static int tcp_select_window(struct sock *sk)
  13243.  {
  13244.      int new_window = sk->prot->rspace(sk);
  13245. -
  13246. +    
  13247.  /*
  13248.   * two things are going on here.  First, we don't ever offer a
  13249.   * window less than min(sk->mss, MAX_WINDOW/2).  This is the
  13250. @@ -268,12 +246,9 @@
  13251.    
  13252.    header+=4*iph->ihl;
  13253.     
  13254. -  DPRINTF((DBG_TCP, "TCP: tcp_err(%d, hdr=%X, daddr=%X saddr=%X, protocol=%X)\n",
  13255. -                    err, header, daddr, saddr, protocol));
  13256.  
  13257.    th =(struct tcphdr *)header;
  13258.    sk = get_sock(&tcp_prot, th->source/*dest*/, daddr, th->dest/*source*/, saddr);
  13259. -  print_th(th);
  13260.  
  13261.    if (sk == NULL) return;
  13262.    
  13263. @@ -294,7 +269,6 @@
  13264.      return;
  13265.    }
  13266.  
  13267. -  DPRINTF((DBG_TCP, "TCP: icmp_err got error\n"));
  13268.    sk->err = icmp_err_convert[err & 0xff].errno;
  13269.  
  13270.    /*
  13271. @@ -326,7 +300,6 @@
  13272.    int sum;
  13273.    unsigned long flags;
  13274.  
  13275. -  DPRINTF((DBG_TCP, "tcp_readable(sk=%X)\n", sk));
  13276.    if(sk && sk->debug)
  13277.        printk("tcp_readable: %p - ",sk);
  13278.  
  13279. @@ -362,7 +335,6 @@
  13280.        (sk->urg_seq - sk->copied_seq) <= (counted - sk->copied_seq))
  13281.      amount--;        /* don't count urg data */
  13282.    restore_flags(flags);
  13283. -  DPRINTF((DBG_TCP, "tcp readable returning %d bytes\n", amount));
  13284.    if(sk->debug)
  13285.        printk("got %lu bytes.\n",amount);
  13286.    return(amount);
  13287. @@ -377,9 +349,6 @@
  13288.  static int
  13289.  tcp_select(struct sock *sk, int sel_type, select_table *wait)
  13290.  {
  13291. -  DPRINTF((DBG_TCP, "tcp_select(sk=%X, sel_type = %d, wait = %X)\n",
  13292. -                          sk, sel_type, wait));
  13293. -
  13294.    sk->inuse = 1;
  13295.    switch(sel_type) {
  13296.      case SEL_IN:
  13297. @@ -417,9 +386,6 @@
  13298.      case SEL_OUT:
  13299.          select_wait(sk->sleep, wait);
  13300.          if (sk->shutdown & SEND_SHUTDOWN) {
  13301. -            DPRINTF((DBG_TCP,
  13302. -                "write select on shutdown socket.\n"));
  13303. -
  13304.              /* FIXME: should this return an error? */
  13305.              release_sock(sk);
  13306.              return(0);
  13307. @@ -437,13 +403,6 @@
  13308.                  sk->state == TCP_SYN_SENT) return(0);
  13309.              return(1);
  13310.          }
  13311. -        DPRINTF((DBG_TCP,
  13312. -            "tcp_select: sleeping on write sk->wmem_alloc = %d, "
  13313. -            "sk->packets_out = %d\n"
  13314. -            "sk->write_seq = %u, sk->window_seq=%u\n", 
  13315. -                sk->wmem_alloc, sk->packets_out,
  13316. -                sk->write_seq, sk->window_seq));
  13317. -
  13318.          release_sock(sk);
  13319.          return(0);
  13320.      case SEL_EX:
  13321. @@ -465,10 +424,7 @@
  13322.  tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
  13323.  {
  13324.    int err;
  13325. -  DPRINTF((DBG_TCP, "tcp_ioctl(sk=%X, cmd = %d, arg=%X)\n", sk, cmd, arg));
  13326.    switch(cmd) {
  13327. -    case DDIOCSDBG:
  13328. -        return(dbg_ioctl((void *) arg, DBG_TCP));
  13329.  
  13330.      case TIOCINQ:
  13331.  #ifdef FIXME    /* FIXME: */
  13332. @@ -482,7 +438,6 @@
  13333.              sk->inuse = 1;
  13334.              amount = tcp_readable(sk);
  13335.              release_sock(sk);
  13336. -            DPRINTF((DBG_TCP, "returning %d\n", amount));
  13337.              err=verify_area(VERIFY_WRITE,(void *)arg,
  13338.                             sizeof(unsigned long));
  13339.              if(err)
  13340. @@ -528,7 +483,6 @@
  13341.    unsigned long sum;
  13342.     
  13343.    if (saddr == 0) saddr = ip_my_addr();
  13344. -  print_th(th);
  13345.    __asm__("\t addl %%ecx,%%ebx\n"
  13346.        "\t adcl %%edx,%%ebx\n"
  13347.        "\t adcl $0, %%ebx\n"
  13348. @@ -625,10 +579,6 @@
  13349.      if (after(skb->h.seq, sk->window_seq) ||
  13350.          (sk->retransmits && sk->timeout == TIME_WRITE) ||
  13351.           sk->packets_out >= sk->cong_window) {
  13352. -        DPRINTF((DBG_TCP, "sk->cong_window = %d, sk->packets_out = %d\n",
  13353. -                    sk->cong_window, sk->packets_out));
  13354. -        DPRINTF((DBG_TCP, "sk->write_seq = %d, sk->window_seq = %d\n",
  13355. -                    sk->write_seq, sk->window_seq));
  13356.          if (skb->next != NULL) {
  13357.              printk("tcp_send_partial: next != NULL\n");
  13358.              skb_unlink(skb);
  13359. @@ -718,8 +668,6 @@
  13360.          {
  13361.              reset_timer(sk, TIME_WRITE, 10);
  13362.          }
  13363. -          if (inet_debug == DBG_SLIP)
  13364. -              printk("\rtcp_ack: malloc failed\n");
  13365.          return;
  13366.      }
  13367.  
  13368. @@ -735,8 +683,6 @@
  13369.      {
  13370.            buff->free=1;
  13371.          sk->prot->wfree(sk, buff->mem_addr, buff->mem_len);
  13372. -        if (inet_debug == DBG_SLIP)
  13373. -            printk("\rtcp_ack: build_header failed\n");
  13374.          return;
  13375.      }
  13376.      buff->len += tmp;
  13377. @@ -823,9 +769,6 @@
  13378.      struct proto *prot;
  13379.      struct device *dev = NULL;
  13380.  
  13381. -    DPRINTF((DBG_TCP, "tcp_write(sk=%X, from=%X, len=%d, nonblock=%d, flags=%X)\n",
  13382. -                    sk, from, len, nonblock, flags));
  13383. -
  13384.      sk->inuse=1;
  13385.      prot = sk->prot;
  13386.      while(len > 0) 
  13387. @@ -874,7 +817,6 @@
  13388.              if (sk->state != TCP_SYN_SENT && sk->state != TCP_SYN_RECV) 
  13389.              {
  13390.                  release_sock(sk);
  13391. -                DPRINTF((DBG_TCP, "tcp_write: return 1\n"));
  13392.                  if (copied) 
  13393.                      return(copied);
  13394.  
  13395. @@ -895,7 +837,6 @@
  13396.              if (nonblock || copied) 
  13397.              {
  13398.                  release_sock(sk);
  13399. -                DPRINTF((DBG_TCP, "tcp_write: return 2\n"));
  13400.                  if (copied) 
  13401.                      return(copied);
  13402.                  return(-EAGAIN);
  13403. @@ -911,7 +852,6 @@
  13404.                  if (current->signal & ~current->blocked) 
  13405.                  {
  13406.                      sti();
  13407. -                    DPRINTF((DBG_TCP, "tcp_write: return 3\n"));
  13408.                      if (copied) 
  13409.                          return(copied);
  13410.                      return(-ERESTARTSYS);
  13411. @@ -1027,7 +967,6 @@
  13412.              if (nonblock /* || copied */) 
  13413.              {
  13414.                  release_sock(sk);
  13415. -                DPRINTF((DBG_TCP, "tcp_write: return 4\n"));
  13416.                  if (copied) 
  13417.                      return(copied);
  13418.                  return(-EAGAIN);
  13419. @@ -1051,7 +990,6 @@
  13420.                  if (current->signal & ~current->blocked) 
  13421.                  {
  13422.                      sti();
  13423. -                    DPRINTF((DBG_TCP, "tcp_write: return 5\n"));
  13424.                      if (copied) 
  13425.                          return(copied);
  13426.                      return(-ERESTARTSYS);
  13427. @@ -1080,7 +1018,6 @@
  13428.          {
  13429.              prot->wfree(sk, skb->mem_addr, skb->mem_len);
  13430.              release_sock(sk);
  13431. -            DPRINTF((DBG_TCP, "tcp_write: return 6\n"));
  13432.              if (copied) 
  13433.                  return(copied);
  13434.              return(tmp);
  13435. @@ -1094,7 +1031,6 @@
  13436.          {
  13437.              prot->wfree(sk, skb->mem_addr, skb->mem_len);
  13438.              release_sock(sk);
  13439. -            DPRINTF((DBG_TCP, "tcp_write: return 7\n"));
  13440.              if (copied) 
  13441.                  return(copied);
  13442.              return(tmp);
  13443. @@ -1142,7 +1078,6 @@
  13444.            tcp_send_partial(sk);
  13445.  
  13446.      release_sock(sk);
  13447. -    DPRINTF((DBG_TCP, "tcp_write: return 8\n"));
  13448.      return(copied);
  13449.  }
  13450.  
  13451. @@ -1176,7 +1111,6 @@
  13452.      struct tcphdr *t1;
  13453.      struct sk_buff *buff;
  13454.  
  13455. -    DPRINTF((DBG_TCP, "in tcp read wakeup\n"));
  13456.      if (!sk->ack_backlog) 
  13457.          return;
  13458.  
  13459. @@ -1284,9 +1218,6 @@
  13460.       * TCP_WINDOW_DIFF.
  13461.       */
  13462.  
  13463. -    DPRINTF((DBG_TCP, "sk->window left = %d, sk->prot->rspace(sk)=%d\n",
  13464. -            sk->window - sk->bytes_rcv, sk->prot->rspace(sk)));
  13465. -
  13466.      if(sk->debug)
  13467.          printk("sk->rspace = %lu, was %d\n", sk->prot->rspace(sk),
  13468.                            left);
  13469. @@ -1398,16 +1329,6 @@
  13470.      unsigned long used;
  13471.      int err;
  13472.  
  13473. -    if (len == 0)
  13474. -        return 0;
  13475. -
  13476. -    if (len < 0)
  13477. -        return -EINVAL;
  13478. -
  13479. -    err = verify_area(VERIFY_WRITE, to, len);
  13480. -    if (err)
  13481. -        return err;
  13482. -
  13483.      /* This error should be checked. */
  13484.      if (sk->state == TCP_LISTEN)
  13485.          return -ENOTCONN;
  13486. @@ -1527,7 +1448,6 @@
  13487.      /* Clean up data we have read: This will do ACK frames */
  13488.      cleanup_rbuf(sk);
  13489.      release_sock(sk);
  13490. -    DPRINTF((DBG_TCP, "tcp_read: returning %d\n", copied));
  13491.      return copied;
  13492.  }
  13493.  
  13494. @@ -1591,7 +1511,6 @@
  13495.          return;
  13496.      sk->inuse = 1;
  13497.  
  13498. -    DPRINTF((DBG_TCP, "tcp_shutdown_send buff = %X\n", buff));
  13499.      buff->sk = sk;
  13500.      buff->len = sizeof(*t1);
  13501.      buff->localroute = sk->localroute;
  13502. @@ -1627,7 +1546,6 @@
  13503.              sk->state = TCP_FIN_WAIT2;
  13504.  
  13505.          release_sock(sk);
  13506. -        DPRINTF((DBG_TCP, "Unable to build header for fin.\n"));
  13507.          return;
  13508.      }
  13509.  
  13510. @@ -1736,7 +1654,6 @@
  13511.      if (buff == NULL) 
  13512.            return;
  13513.  
  13514. -    DPRINTF((DBG_TCP, "tcp_reset buff = %X\n", buff));
  13515.      buff->len = sizeof(*t1);
  13516.      buff->sk = NULL;
  13517.      buff->dev = dev;
  13518. @@ -1848,7 +1765,11 @@
  13519.      if (! mss_seen)
  13520.        sk->mtu=min(sk->mtu, 536);  /* default MSS if none sent */
  13521.    }
  13522. +#ifdef CONFIG_INET_PCTCP
  13523. +  sk->mss = min(sk->max_window >> 1, sk->mtu);
  13524. +#else    
  13525.    sk->mss = min(sk->max_window, sk->mtu);
  13526. +#endif  
  13527.  }
  13528.  
  13529.  static inline unsigned long default_mask(unsigned long dst)
  13530. @@ -1880,10 +1801,7 @@
  13531.    struct tcphdr *th;
  13532.    struct device *ndev=NULL;
  13533.    int tmp;
  13534. -
  13535. -  DPRINTF((DBG_TCP, "tcp_conn_request(sk = %X, skb = %X, daddr = %X, sadd4= %X, \n"
  13536. -      "                  opt = %X, dev = %X)\n",
  13537. -      sk, skb, daddr, saddr, opt, dev));
  13538. +  struct rtable *rt;
  13539.    
  13540.    th = skb->h.th;
  13541.  
  13542. @@ -1891,7 +1809,6 @@
  13543.    if (!sk->dead) {
  13544.        sk->data_ready(sk,0);
  13545.    } else {
  13546. -    DPRINTF((DBG_TCP, "tcp_conn_request on dead socket\n"));
  13547.      tcp_reset(daddr, saddr, th, sk->prot, opt, dev, sk->ip_tos,sk->ip_ttl);
  13548.      tcp_statistics.TcpAttemptFails++;
  13549.      kfree_skb(skb, FREE_READ);
  13550. @@ -1923,15 +1840,14 @@
  13551.      return;
  13552.    }
  13553.  
  13554. -  DPRINTF((DBG_TCP, "newsk = %X\n", newsk));
  13555.    memcpy(newsk, sk, sizeof(*newsk));
  13556.    skb_queue_head_init(&newsk->write_queue);
  13557.    skb_queue_head_init(&newsk->receive_queue);
  13558.    newsk->send_head = NULL;
  13559.    newsk->send_tail = NULL;
  13560.    skb_queue_head_init(&newsk->back_log);
  13561. -  newsk->rtt = TCP_CONNECT_TIME << 3;
  13562. -  newsk->rto = TCP_CONNECT_TIME;
  13563. +  newsk->rtt = 0;        /*TCP_CONNECT_TIME<<3*/
  13564. +  newsk->rto = TCP_TIMEOUT_INIT;
  13565.    newsk->mdev = 0;
  13566.    newsk->max_window = 0;
  13567.    newsk->cong_window = 1;
  13568. @@ -1992,8 +1908,11 @@
  13569.  
  13570.  /* use 512 or whatever user asked for */
  13571.  /* note use of sk->user_mss, since user has no direct access to newsk */
  13572. +  rt=ip_rt_route(saddr, NULL,NULL);
  13573.    if (sk->user_mss)
  13574.      newsk->mtu = sk->user_mss;
  13575. +  else if(rt!=NULL && (rt->rt_flags&RTF_MTU))
  13576. +    newsk->mtu = rt->rt_mtu - HEADER_SIZE;
  13577.    else {
  13578.  #ifdef CONFIG_INET_SNARL    /* Sub Nets ARe Local */
  13579.      if ((saddr ^ daddr) & default_mask(saddr))
  13580. @@ -2075,7 +1994,7 @@
  13581.    tcp_send_check(t1, daddr, saddr, sizeof(*t1)+4, newsk);
  13582.    newsk->prot->queue_xmit(newsk, dev, buff, 0);
  13583.  
  13584. -  reset_timer(newsk, TIME_WRITE /* -1 ? FIXME ??? */, TCP_CONNECT_TIME);
  13585. +  reset_timer(newsk, TIME_WRITE /* -1 ? FIXME ??? */, TCP_TIMEOUT_INIT);
  13586.    skb->sk = newsk;
  13587.  
  13588.    /* Charge the sock_buff to newsk. */
  13589. @@ -2102,7 +2021,6 @@
  13590.       * We need to grab some memory, and put together a FIN,    
  13591.       * and then put it into the queue to be sent.
  13592.       */
  13593. -    DPRINTF((DBG_TCP, "tcp_close((struct sock *)%X, %d)\n",sk, timeout));
  13594.      sk->inuse = 1;
  13595.      sk->keepopen = 1;
  13596.      sk->shutdown = SHUTDOWN_MASK;
  13597. @@ -2231,7 +2149,6 @@
  13598.                  if(timeout)
  13599.                      tcp_time_wait(sk);
  13600.  
  13601. -                DPRINTF((DBG_TCP, "Unable to build header for fin.\n"));
  13602.                  release_sock(sk);
  13603.                  return;
  13604.              }
  13605. @@ -2302,8 +2219,6 @@
  13606.  {
  13607.    struct sk_buff *skb;
  13608.  
  13609. -  DPRINTF((DBG_TCP, "tcp_write_xmit(sk=%X)\n", sk));
  13610. -
  13611.    /* The bytes will have to remain here. In time closedown will
  13612.       empty the write queue and all will be happy */
  13613.    if(sk->zapped)
  13614. @@ -2317,8 +2232,6 @@
  13615.      && sk->packets_out < sk->cong_window) {
  13616.          IS_SKB(skb);
  13617.          skb_unlink(skb);
  13618. -        DPRINTF((DBG_TCP, "Sending a packet.\n"));
  13619. -
  13620.          /* See if we really need to send the packet. */
  13621.          if (before(skb->h.seq, sk->rcv_ack_seq +1)) {
  13622.              sk->retransmits = 0;
  13623. @@ -2384,13 +2297,13 @@
  13624.      return(1);    /* Dead, cant ack any more so why bother */
  13625.  
  13626.    ack = ntohl(th->ack_seq);
  13627. -  DPRINTF((DBG_TCP, "tcp_ack ack=%d, window=%d, "
  13628. -      "sk->rcv_ack_seq=%d, sk->window_seq = %d\n",
  13629. -      ack, ntohs(th->window), sk->rcv_ack_seq, sk->window_seq));
  13630. -
  13631.    if (ntohs(th->window) > sk->max_window) {
  13632.        sk->max_window = ntohs(th->window);
  13633. +#ifdef CONFIG_INET_PCTCP
  13634. +    sk->mss = min(sk->max_window>>1, sk->mtu);
  13635. +#else
  13636.      sk->mss = min(sk->max_window, sk->mtu);
  13637. +#endif    
  13638.    }
  13639.  
  13640.    if (sk->retransmits && sk->timeout == TIME_KEEPOPEN)
  13641. @@ -2496,7 +2409,6 @@
  13642.      }
  13643.    }
  13644.  
  13645. -  DPRINTF((DBG_TCP, "tcp_ack: Updating rcv ack sequence.\n"));
  13646.    sk->rcv_ack_seq = ack;
  13647.  
  13648.    /*
  13649. @@ -2513,8 +2425,8 @@
  13650.        sk->rto = ((sk->rtt >> 2) + sk->mdev) >> 1;
  13651.        if (sk->rto > 120*HZ)
  13652.          sk->rto = 120*HZ;
  13653. -      if (sk->rto < 1*HZ)
  13654. -        sk->rto = 1*HZ;
  13655. +      if (sk->rto < 2)    /* Was 1*HZ */
  13656. +        sk->rto = 2;
  13657.      }
  13658.    }
  13659.  
  13660. @@ -2564,9 +2476,6 @@
  13661.  
  13662.          /* We have one less packet out there. */
  13663.          if (sk->packets_out > 0) sk->packets_out --;
  13664. -        DPRINTF((DBG_TCP, "skb=%X skb->h.seq = %d acked ack=%d\n",
  13665. -                sk->send_head, sk->send_head->h.seq, ack));
  13666. -
  13667.          /* Wake up the process, it can probably write more. */
  13668.          if (!sk->dead) sk->write_space(sk);
  13669.  
  13670. @@ -2583,6 +2492,8 @@
  13671.             */
  13672.  
  13673.            m = jiffies - oskb->when;  /* RTT */
  13674. +          if(m<=0)
  13675. +              m=1;             /* IS THIS RIGHT FOR <0 ??? */
  13676.            m -= (sk->rtt >> 3);       /* m is now error in rtt est */
  13677.            sk->rtt += m;              /* rtt = 7/8 rtt + 1/8 new */
  13678.            if (m < 0)
  13679. @@ -2594,8 +2505,8 @@
  13680.            sk->rto = ((sk->rtt >> 2) + sk->mdev) >> 1;
  13681.            if (sk->rto > 120*HZ)
  13682.              sk->rto = 120*HZ;
  13683. -          if (sk->rto < 1*HZ)
  13684. -            sk->rto = 1*HZ;
  13685. +          if (sk->rto < 2)    /* Was 1*HZ */
  13686. +            sk->rto = 2;
  13687.            sk->backoff = 0;
  13688.  
  13689.          }
  13690. @@ -2642,7 +2553,6 @@
  13691.    } else {
  13692.      if (sk->send_head == NULL && sk->ack_backlog == 0 &&
  13693.          sk->state != TCP_TIME_WAIT && !sk->keepopen) {
  13694. -        DPRINTF((DBG_TCP, "Nothing to do, going to sleep.\n")); 
  13695.          if (!sk->dead) sk->write_space(sk);
  13696.  
  13697.          if (sk->keepopen)
  13698. @@ -2676,16 +2586,7 @@
  13699.    if (sk->state == TCP_LAST_ACK) {
  13700.      if (!sk->dead)
  13701.          sk->state_change(sk);
  13702. -    DPRINTF((DBG_TCP, "TCP_LAST_ACK-A: %d/%d %d/%d ack/sent %d %d\n",
  13703. -        sk->rcv_ack_seq,
  13704. -        sk->write_seq,
  13705. -        sk->acked_seq,
  13706. -        sk->fin_seq,
  13707. -        ack,
  13708. -        sk->sent_seq
  13709. -    ));
  13710.      if (sk->rcv_ack_seq == sk->write_seq && sk->acked_seq == sk->fin_seq) {
  13711. -        DPRINTF((DBG_TCP, "tcp_ack closing socket - %X\n", sk));
  13712.          flag |= 1;
  13713.          sk->state = TCP_CLOSE;
  13714.          sk->shutdown = SHUTDOWN_MASK;
  13715. @@ -2763,7 +2664,6 @@
  13716.      reset_timer(sk, TIME_WRITE, sk->rto);
  13717.        }
  13718.  
  13719. -  DPRINTF((DBG_TCP, "leaving tcp_ack\n"));
  13720.    return(1);
  13721.  }
  13722.  
  13723. @@ -2782,11 +2682,8 @@
  13724.    int dup_dumped=0;
  13725.  
  13726.    th = skb->h.th;
  13727. -  print_th(th);
  13728.    skb->len = len -(th->doff*4);
  13729.  
  13730. -  DPRINTF((DBG_TCP, "tcp_data len = %d sk = %X:\n", skb->len, sk));
  13731. -
  13732.    sk->bytes_rcv += skb->len;
  13733.    if (skb->len == 0 && !th->fin && !th->urg && !th->psh) {
  13734.      /* Don't want to keep passing ack's back and forth. */
  13735. @@ -2795,7 +2692,7 @@
  13736.      return(0);
  13737.    }
  13738.  
  13739. -  if (sk->shutdown & RCV_SHUTDOWN) {
  13740. +  if (sk->shutdown & RCV_SHUTDOWN && skb->len!=0 /* Added AGC */) {
  13741.      sk->acked_seq = th->seq + skb->len + th->syn + th->fin;
  13742.      tcp_reset(sk->saddr, sk->daddr, skb->h.th,
  13743.          sk->prot, NULL, skb->dev, sk->ip_tos, sk->ip_ttl);
  13744. @@ -2803,7 +2700,6 @@
  13745.      sk->state = TCP_CLOSE;
  13746.      sk->err = EPIPE;
  13747.      sk->shutdown = SHUTDOWN_MASK;
  13748. -    DPRINTF((DBG_TCP, "tcp_data: closing socket - %X\n", sk));
  13749.      kfree_skb(skb, FREE_READ);
  13750.      if (!sk->dead) sk->state_change(sk);
  13751.      return(0);
  13752. @@ -2819,11 +2715,9 @@
  13753.  
  13754.    /* This should start at the last one, and then go around forwards. */
  13755.    if (skb_peek(&sk->receive_queue) == NULL) {
  13756. -    DPRINTF((DBG_TCP, "tcp_data: skb = %X:\n", skb));
  13757.      skb_queue_head(&sk->receive_queue,skb);
  13758.      skb1= NULL;
  13759.    } else {
  13760. -    DPRINTF((DBG_TCP, "tcp_data adding to chain sk = %X:\n", sk));
  13761.      for(skb1=sk->receive_queue.prev; ; skb1 = skb1->prev) {
  13762.          if(sk->debug)
  13763.          {
  13764. @@ -2853,7 +2747,6 @@
  13765.              break;
  13766.          }
  13767.      }
  13768. -    DPRINTF((DBG_TCP, "skb = %X:\n", skb));
  13769.    }
  13770.  
  13771.    th->ack_seq = th->seq + skb->len;
  13772. @@ -2973,16 +2866,12 @@
  13773.          if(sk->debug)
  13774.              printk("Data wakeup.\n");
  13775.      sk->data_ready(sk,0);
  13776. -  } else {
  13777. -    DPRINTF((DBG_TCP, "data received on dead socket.\n"));
  13778. -  }
  13779. +  } 
  13780.  
  13781.  #ifdef NOTDEF     /* say what?  this is handled by tcp_ack() */
  13782.  
  13783.    if (sk->state == TCP_FIN_WAIT2 &&
  13784.        sk->acked_seq == sk->fin_seq && sk->rcv_ack_seq == sk->write_seq) {
  13785. -    DPRINTF((DBG_TCP, "tcp_data: entering last_ack state sk = %X\n", sk));
  13786. -
  13787.  /*    tcp_send_ack(sk->sent_seq, sk->acked_seq, sk, th, saddr); */
  13788.      sk->shutdown = SHUTDOWN_MASK;
  13789.      sk->state = TCP_LAST_ACK;
  13790. @@ -3065,9 +2954,6 @@
  13791.  static int tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th, 
  13792.       unsigned long saddr, struct device *dev)
  13793.  {
  13794. -    DPRINTF((DBG_TCP, "tcp_fin(sk=%X, th=%X, saddr=%X, dev=%X)\n",
  13795. -                    sk, th, saddr, dev));
  13796. -  
  13797.      sk->fin_seq = th->seq + skb->len + th->syn + th->fin;
  13798.  
  13799.      if (!sk->dead) 
  13800. @@ -3152,9 +3038,6 @@
  13801.    struct sock *newsk;
  13802.    struct sk_buff *skb;
  13803.    
  13804. -  DPRINTF((DBG_TCP, "tcp_accept(sk=%X, flags=%X, addr=%s)\n",
  13805. -                sk, flags, in_ntoa(sk->saddr)));
  13806. -
  13807.    /*
  13808.     * We need to make sure that this socket is listening,
  13809.     * and that it has something pending.
  13810. @@ -3209,6 +3092,7 @@
  13811.      int tmp;
  13812.      struct tcphdr *t1;
  13813.      int err;
  13814. +    struct rtable *rt;
  13815.  
  13816.      if (sk->state != TCP_CLOSE) 
  13817.          return(-EISCONN);
  13818. @@ -3224,8 +3108,6 @@
  13819.      if (sin.sin_family && sin.sin_family != AF_INET) 
  13820.          return(-EAFNOSUPPORT);
  13821.  
  13822. -    DPRINTF((DBG_TCP, "TCP connect daddr=%s\n", in_ntoa(sin.sin_addr.s_addr)));
  13823. -      
  13824.        /*
  13825.         *    connect() to INADDR_ANY means loopback (BSD'ism).
  13826.         */
  13827. @@ -3239,8 +3121,7 @@
  13828.  
  13829.      if (ip_chk_addr(sin.sin_addr.s_addr) == IS_BROADCAST) 
  13830.      { 
  13831. -        DPRINTF((DBG_TCP, "TCP connection to broadcast address not allowed\n"));
  13832. -        return(-ENETUNREACH);
  13833. +        return -ENETUNREACH;
  13834.      }
  13835.    
  13836.      /*
  13837. @@ -3275,6 +3156,9 @@
  13838.      /*
  13839.       *    Put in the IP header and routing stuff. 
  13840.       */
  13841. +     
  13842. +    rt=ip_rt_route(sk->daddr, NULL, NULL);
  13843. +    
  13844.  
  13845.      /*
  13846.       *    We need to build the routing stuff fromt the things saved in skb. 
  13847. @@ -3310,6 +3194,8 @@
  13848.  
  13849.      if (sk->user_mss)
  13850.          sk->mtu = sk->user_mss;
  13851. +    else if(rt!=NULL && rt->rt_flags&RTF_MTU)
  13852. +        sk->mtu = rt->rt_mtu;
  13853.      else 
  13854.      {
  13855.  #ifdef SUBNETSARELOCAL
  13856. @@ -3325,8 +3211,11 @@
  13857.       *    but not bigger than device MTU 
  13858.       */
  13859.  
  13860. +    if(sk->mtu <32)
  13861. +        sk->mtu = 32;    /* Sanity limit */
  13862. +        
  13863.      sk->mtu = min(sk->mtu, dev->mtu - HEADER_SIZE);
  13864. -
  13865. +    
  13866.      /*
  13867.       *    Put in the TCP options to say MTU. 
  13868.       */
  13869. @@ -3344,8 +3233,9 @@
  13870.       */
  13871.  
  13872.      sk->state = TCP_SYN_SENT;
  13873. -    sk->rtt = TCP_CONNECT_TIME;
  13874. -    reset_timer(sk, TIME_WRITE, TCP_CONNECT_TIME);    /* Timer for repeating the SYN until an answer */
  13875. +/*    sk->rtt = TCP_CONNECT_TIME;*/
  13876. +    sk->rto = TCP_TIMEOUT_INIT;
  13877. +    reset_timer(sk, TIME_WRITE, sk->rto);    /* Timer for repeating the SYN until an answer */
  13878.      sk->retransmits = TCP_RETR2 - TCP_SYN_RETRIES;
  13879.  
  13880.      sk->prot->queue_xmit(sk, dev, buff, 0);  
  13881. @@ -3390,8 +3280,6 @@
  13882.      return 1;
  13883.  
  13884.  ignore_it:
  13885. -    DPRINTF((DBG_TCP, "tcp_sequence: rejecting packet.\n"));
  13886. -
  13887.      if (th->rst)
  13888.          return 0;
  13889.  
  13890. @@ -3422,13 +3310,11 @@
  13891.    struct sock *sk;
  13892.  
  13893.    if (!skb) {
  13894. -    DPRINTF((DBG_TCP, "tcp.c: tcp_rcv skb = NULL\n"));
  13895.      return(0);
  13896.    }
  13897.  
  13898.    if (!dev) 
  13899.    {
  13900. -    DPRINTF((DBG_TCP, "tcp.c: tcp_rcv dev = NULL\n"));
  13901.      return(0);
  13902.    }
  13903.    
  13904. @@ -3438,23 +3324,14 @@
  13905.  
  13906.    /* Find the socket. */
  13907.    sk = get_sock(&tcp_prot, th->dest, saddr, th->source, daddr);
  13908. -  DPRINTF((DBG_TCP, "<<\n"));
  13909. -  DPRINTF((DBG_TCP, "len = %d, redo = %d, skb=%X\n", len, redo, skb));
  13910. -  
  13911.    /* If this socket has got a reset its to all intents and purposes 
  13912.       really dead */
  13913.    if (sk!=NULL && sk->zapped)
  13914.      sk=NULL;
  13915.  
  13916. -  if (sk) {
  13917. -     DPRINTF((DBG_TCP, "sk = %X:\n", sk));
  13918. -  }
  13919. -
  13920.    if (!redo) {
  13921.      if (tcp_check(th, len, saddr, daddr )) {
  13922.          skb->sk = NULL;
  13923. -        DPRINTF((DBG_TCP, "packet dropped with bad checksum.\n"));
  13924. -if (inet_debug == DBG_SLIP) printk("\rtcp_rcv: bad checksum\n");
  13925.          kfree_skb(skb,FREE_READ);
  13926.          /*
  13927.           * We don't release the socket because it was
  13928. @@ -3493,27 +3370,23 @@
  13929.      sti();
  13930.    } else {
  13931.      if (!sk) {
  13932. -        DPRINTF((DBG_TCP, "tcp.c: tcp_rcv bug sk=NULL redo = 1\n"));
  13933.          return(0);
  13934.      }
  13935.    }
  13936.  
  13937.    if (!sk->prot) {
  13938. -    DPRINTF((DBG_TCP, "tcp.c: tcp_rcv sk->prot = NULL \n"));
  13939.      return(0);
  13940.    }
  13941.  
  13942.    /* Charge the memory to the socket. */
  13943.    if (sk->rmem_alloc + skb->mem_len >= sk->rcvbuf) {
  13944.      skb->sk = NULL;
  13945. -    DPRINTF((DBG_TCP, "dropping packet due to lack of buffer space.\n"));
  13946.      kfree_skb(skb, FREE_READ);
  13947.      release_sock(sk);
  13948.      return(0);
  13949.    }
  13950.    sk->rmem_alloc += skb->mem_len;
  13951.  
  13952. -  DPRINTF((DBG_TCP, "About to do switch.\n"));
  13953.  
  13954.    /* Now deal with it. */
  13955.    switch(sk->state) {
  13956. @@ -3542,8 +3415,6 @@
  13957.      case TCP_FIN_WAIT2:
  13958.      case TCP_TIME_WAIT:
  13959.          if (!tcp_sequence(sk, th, len, opt, saddr,dev)) {
  13960. -            if (inet_debug == DBG_SLIP) 
  13961. -                printk("\rtcp_rcv: not in seq\n");
  13962.              kfree_skb(skb, FREE_READ);
  13963.              release_sock(sk);
  13964.              return(0);
  13965. @@ -3622,7 +3493,6 @@
  13966.  
  13967.      case TCP_CLOSE:
  13968.          if (sk->dead || sk->daddr) {
  13969. -            DPRINTF((DBG_TCP, "packet received for closed,dead socket\n"));
  13970.              kfree_skb(skb, FREE_READ);
  13971.              release_sock(sk);
  13972.              return(0);
  13973. @@ -3864,7 +3734,6 @@
  13974.      buff->sk = sk;
  13975.      buff->localroute = sk->localroute;
  13976.  
  13977. -    DPRINTF((DBG_TCP, "in tcp_write_wakeup\n"));
  13978.      t1 = (struct tcphdr *) buff->data;
  13979.  
  13980.      /* Put in the IP header and routing stuff. */
  13981. Only in linux.old/net/inet: tcp.c.orig
  13982. diff -u --new-file --recursive linux.old/net/inet/tcp.h linux/net/inet/tcp.h
  13983. --- linux.old/net/inet/tcp.h    Fri May 20 18:42:57 1994
  13984. +++ linux/net/inet/tcp.h    Fri May 20 18:50:40 1994
  13985. @@ -49,13 +49,13 @@
  13986.  #define TCP_TIMEOUT_LEN    (15*60*HZ) /* should be about 15 mins        */
  13987.  #define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to sucessfully 
  13988.                    * close the socket, about 60 seconds    */
  13989. -#define TCP_ACK_TIME    3000    /* time to delay before sending an ACK    */
  13990. +#define TCP_ACK_TIME    (3*HZ)    /* time to delay before sending an ACK    */
  13991.  #define TCP_DONE_TIME    250    /* maximum time to wait before actually
  13992.                   * destroying a socket            */
  13993.  #define TCP_WRITE_TIME    3000    /* initial time to wait for an ACK,
  13994.                       * after last transmit            */
  13995. -#define TCP_CONNECT_TIME 2000    /* time to retransmit first SYN        */
  13996. -#define TCP_SYN_RETRIES    5    /* number of times to retry openning a
  13997. +#define TCP_TIMEOUT_INIT (3*HZ)    /* RFC 1122 initial timeout value    */
  13998. +#define TCP_SYN_RETRIES    5    /* number of times to retry opening a
  13999.                   * connection                 */
  14000.  #define TCP_PROBEWAIT_LEN 100    /* time to wait between probes when
  14001.                   * I've got something to write and
  14002. Only in linux.old/net/inet: tcp.h.orig
  14003. diff -u --new-file --recursive linux.old/net/inet/timer.c linux/net/inet/timer.c
  14004. --- linux.old/net/inet/timer.c    Fri May 20 18:47:44 1994
  14005. +++ linux/net/inet/timer.c    Fri May 20 18:50:40 1994
  14006. @@ -3,7 +3,7 @@
  14007.   *        operating system.  INET is implemented using the  BSD Socket
  14008.   *        interface as the means of communication with the user level.
  14009.   *
  14010. - *        TIMER - implementation of software timers.
  14011. + *        TIMER - implementation of software timers for IP.
  14012.   *
  14013.   * Version:    @(#)timer.c    1.0.7    05/25/93
  14014.   *
  14015. @@ -22,7 +22,7 @@
  14016.   *                    the socket will get removed BEFORE this is called
  14017.   *                    otherwise if the timer TIME_DESTROY occurs inside
  14018.   *                    of inet_bh() with this socket being handled it goes
  14019. - *                    BOOM! Have to stop timer going off if inet_bh is
  14020. + *                    BOOM! Have to stop timer going off if net_bh is
  14021.   *                    active or the destroy causes crashes.
  14022.   *
  14023.   *        This program is free software; you can redistribute it and/or
  14024. @@ -49,202 +49,213 @@
  14025.  #include "sock.h"
  14026.  #include "arp.h"
  14027.  
  14028. -void
  14029. -delete_timer (struct sock *t)
  14030. +void delete_timer (struct sock *t)
  14031.  {
  14032. -  unsigned long flags;
  14033. +    unsigned long flags;
  14034.  
  14035. -  save_flags (flags);
  14036. -  cli();
  14037. +    save_flags (flags);
  14038. +    cli();
  14039.  
  14040. -  t->timeout = 0;
  14041. -  del_timer (&t->timer);
  14042. +    t->timeout = 0;
  14043. +    del_timer (&t->timer);
  14044.  
  14045. -  restore_flags (flags);
  14046. +    restore_flags (flags);
  14047.  }
  14048.  
  14049. -void
  14050. -reset_timer (struct sock *t, int timeout, unsigned long len)
  14051. +void reset_timer (struct sock *t, int timeout, unsigned long len)
  14052.  {
  14053. -  delete_timer (t);
  14054. -
  14055. -  t->timeout = timeout;
  14056. -
  14057. +    delete_timer (t);
  14058. +    t->timeout = timeout;
  14059.  #if 1
  14060.    /* FIXME: ??? */
  14061. -  if ((int) len < 0)    /* prevent close to infinite timers. THEY _DO_ */
  14062. -    len = 3;    /* happen (negative values ?) - don't ask me why ! -FB */
  14063. +    if ((int) len < 0)    /* prevent close to infinite timers. THEY _DO_ */
  14064. +        len = 3;    /* happen (negative values ?) - don't ask me why ! -FB */
  14065.  #endif
  14066. -  t->timer.expires = len;
  14067. -  add_timer (&t->timer);
  14068. +    t->timer.expires = len;
  14069. +    add_timer (&t->timer);
  14070.  }
  14071.  
  14072.  
  14073.  /*
  14074. - * Now we will only be called whenever we need to do
  14075. - * something, but we must be sure to process all of the
  14076. - * sockets that need it.
  14077. + *    Now we will only be called whenever we need to do
  14078. + *    something, but we must be sure to process all of the
  14079. + *    sockets that need it.
  14080.   */
  14081. -void
  14082. -net_timer (unsigned long data)
  14083. +
  14084. +void net_timer (unsigned long data)
  14085.  {
  14086. -  struct sock *sk = (struct sock*)data;
  14087. -  int why = sk->timeout;
  14088. -  /* timeout is overwritten by 'delete_timer' and 'reset_timer' */
  14089. -
  14090. -  cli();
  14091. -  if (sk->inuse || in_bh) {
  14092. -    sk->timer.expires = 10;
  14093. -    add_timer(&sk->timer);
  14094. -    sti();
  14095. -    return;
  14096. -  }
  14097. -  sk->inuse = 1;
  14098. -  sti();
  14099. -
  14100. -  DPRINTF ((DBG_TMR, "net_timer: found sk=%X why = %d\n", sk, why));
  14101. -  if (skb_peek(&sk->write_queue) && 
  14102. -      before(sk->window_seq, sk->write_queue.next->h.seq) &&
  14103. -      sk->send_head == NULL &&
  14104. -      sk->ack_backlog == 0 &&
  14105. -      sk->state != TCP_TIME_WAIT)
  14106. -    reset_timer(sk, TIME_PROBE0, sk->rto);
  14107. -  else if (sk->keepopen)
  14108. -    reset_timer (sk, TIME_KEEPOPEN, TCP_TIMEOUT_LEN);
  14109. -
  14110. -  /* Always see if we need to send an ack. */
  14111. -  if (sk->ack_backlog) {
  14112. -    sk->prot->read_wakeup (sk);
  14113. -    if (! sk->dead)
  14114. -        sk->data_ready(sk,0);
  14115. -  }
  14116. -
  14117. -  /* Now we need to figure out why the socket was on the timer. */
  14118. -  switch (why) {
  14119. -    case TIME_DONE:
  14120. -    if (! sk->dead || sk->state != TCP_CLOSE) {
  14121. -      printk ("non dead socket in time_done\n");
  14122. -      release_sock (sk);
  14123. -      break;
  14124. -    }
  14125. -    destroy_sock (sk);
  14126. -    break;
  14127. -    case TIME_DESTROY:
  14128. -    /* We've waited for a while for all the memory associated with
  14129. -     * the socket to be freed.  We need to print an error message.
  14130. -     */
  14131. -    if(sk->wmem_alloc!=0 || sk->rmem_alloc!=0)
  14132. -    {
  14133. -        DPRINTF ((DBG_TMR, "possible memory leak.  sk = %X\n", sk));
  14134. -        sk->wmem_alloc++;    /* So it DOESNT go away */
  14135. -        destroy_sock (sk);
  14136. -        sk->wmem_alloc--;    /* Might now have hit 0 - fall through and do it again if so */
  14137. -        sk->inuse = 0;    /* This will be ok, the destroy won't totally work */
  14138. -    }
  14139. -    if(sk->wmem_alloc==0 && sk->rmem_alloc==0)
  14140. -        destroy_sock(sk);    /* Socket gone, DONT update sk->inuse! */
  14141. -    break;
  14142. -    case TIME_CLOSE:
  14143. -    /* We've waited long enough, close the socket. */
  14144. -    sk->state = TCP_CLOSE;
  14145. -    delete_timer (sk);
  14146. -    /* Kill the ARP entry in case the hardware has changed. */
  14147. -    arp_destroy (sk->daddr, 0);
  14148. -    if (!sk->dead)
  14149. -      sk->state_change(sk);
  14150. -    sk->shutdown = SHUTDOWN_MASK;
  14151. -    reset_timer (sk, TIME_DESTROY, TCP_DONE_TIME);
  14152. -    release_sock (sk);
  14153. -    break;
  14154. -    case TIME_PROBE0:
  14155. -    tcp_send_probe0(sk);
  14156. -    release_sock (sk);
  14157. -    break;
  14158. -    case TIME_WRITE:    /* try to retransmit. */
  14159. -    /* It could be we got here because we needed to send an ack.
  14160. -     * So we need to check for that.
  14161. -     */
  14162. -    {
  14163. -    struct sk_buff *skb;
  14164. -    unsigned long flags;
  14165. +    struct sock *sk = (struct sock*)data;
  14166. +    int why = sk->timeout;
  14167. +    /* timeout is overwritten by 'delete_timer' and 'reset_timer' */
  14168.  
  14169. -    save_flags(flags);
  14170.      cli();
  14171. -    skb = sk->send_head;
  14172. -    if (!skb) {
  14173. -      restore_flags(flags);
  14174. -    } else {
  14175. -      if (jiffies < skb->when + sk->rto) {
  14176. -        reset_timer (sk, TIME_WRITE, skb->when + sk->rto - jiffies);
  14177. -        restore_flags(flags);
  14178. -        release_sock (sk);
  14179. -        break;
  14180. -      }
  14181. -      restore_flags(flags);
  14182. -      /* printk("timer: seq %d retrans %d out %d cong %d\n", sk->send_head->h.seq,
  14183. -         sk->retransmits, sk->packets_out, sk->cong_window); */
  14184. -      DPRINTF ((DBG_TMR, "retransmitting.\n"));
  14185. -      sk->prot->retransmit (sk, 0);
  14186. -      if ((sk->state == TCP_ESTABLISHED && sk->retransmits && !(sk->retransmits & 7))
  14187. -        || (sk->state != TCP_ESTABLISHED && sk->retransmits > TCP_RETR1)) {
  14188. -        DPRINTF ((DBG_TMR, "timer.c TIME_WRITE time-out 1\n"));
  14189. -        arp_destroy (sk->daddr, 0);
  14190. -        ip_route_check (sk->daddr);
  14191. -      }
  14192. -      if (sk->state != TCP_ESTABLISHED && sk->retransmits > TCP_RETR2) {
  14193. -        DPRINTF ((DBG_TMR, "timer.c TIME_WRITE time-out 2\n"));
  14194. -        sk->err = ETIMEDOUT;
  14195. -        if (sk->state == TCP_FIN_WAIT1 || sk->state == TCP_FIN_WAIT2
  14196. -          || sk->state == TCP_CLOSING) {
  14197. -          sk->state = TCP_TIME_WAIT;
  14198. -          reset_timer (sk, TIME_CLOSE, TCP_TIMEWAIT_LEN);
  14199. -        } else {
  14200. -          sk->prot->close (sk, 1);
  14201. -          break;
  14202. -        }
  14203. -      }
  14204. -    }
  14205. -    release_sock (sk);
  14206. -    break;
  14207. -    }
  14208. -    case TIME_KEEPOPEN:
  14209. -    /* Send something to keep the connection open. */
  14210. -    if (sk->prot->write_wakeup)
  14211. -      sk->prot->write_wakeup (sk);
  14212. -    sk->retransmits++;
  14213. -    if (sk->shutdown == SHUTDOWN_MASK) {
  14214. -      sk->prot->close (sk, 1);
  14215. -      sk->state = TCP_CLOSE;
  14216. -    }
  14217. +    if (sk->inuse || in_bh) 
  14218. +    {
  14219. +        sk->timer.expires = 10;
  14220. +        add_timer(&sk->timer);
  14221. +        sti();
  14222. +        return;
  14223. +    }
  14224. +
  14225. +    sk->inuse = 1;
  14226. +    sti();
  14227. +
  14228. +    if (skb_peek(&sk->write_queue) && 
  14229. +          before(sk->window_seq, sk->write_queue.next->h.seq) &&
  14230. +          sk->send_head == NULL &&
  14231. +          sk->ack_backlog == 0 &&
  14232. +          sk->state != TCP_TIME_WAIT)
  14233. +        reset_timer(sk, TIME_PROBE0, sk->rto);
  14234. +    else if (sk->keepopen)
  14235. +        reset_timer (sk, TIME_KEEPOPEN, TCP_TIMEOUT_LEN);
  14236. +
  14237. +    /* Always see if we need to send an ack. */
  14238.  
  14239. -    if ((sk->state == TCP_ESTABLISHED && sk->retransmits && !(sk->retransmits & 7))
  14240. -      || (sk->state != TCP_ESTABLISHED && sk->retransmits > TCP_RETR1)) {
  14241. -      DPRINTF ((DBG_TMR, "timer.c TIME_KEEPOPEN time-out 1\n"));
  14242. -      arp_destroy (sk->daddr, 0);
  14243. -      ip_route_check (sk->daddr);
  14244. -      release_sock (sk);
  14245. -      break;
  14246. +    if (sk->ack_backlog) 
  14247. +    {
  14248. +        sk->prot->read_wakeup (sk);
  14249. +        if (! sk->dead)
  14250. +        sk->data_ready(sk,0);
  14251.      }
  14252. -    if (sk->state != TCP_ESTABLISHED && sk->retransmits > TCP_RETR2) {
  14253. -      DPRINTF ((DBG_TMR, "timer.c TIME_KEEPOPEN time-out 2\n"));
  14254. -      arp_destroy (sk->daddr, 0);
  14255. -      sk->err = ETIMEDOUT;
  14256. -      if (sk->state == TCP_FIN_WAIT1 || sk->state == TCP_FIN_WAIT2) {
  14257. -        sk->state = TCP_TIME_WAIT;
  14258. -        if (!sk->dead)
  14259. -          sk->state_change(sk);
  14260. -        release_sock (sk);
  14261. -      } else {
  14262. -        sk->prot->close (sk, 1);
  14263. -      }
  14264. -      break;
  14265. +
  14266. +    /* Now we need to figure out why the socket was on the timer. */
  14267. +
  14268. +    switch (why) 
  14269. +    {
  14270. +        case TIME_DONE:
  14271. +            if (! sk->dead || sk->state != TCP_CLOSE) 
  14272. +            {
  14273. +                printk ("non dead socket in time_done\n");
  14274. +                release_sock (sk);
  14275. +                break;
  14276. +            }
  14277. +            destroy_sock (sk);
  14278. +            break;
  14279. +
  14280. +        case TIME_DESTROY:
  14281. +        /*
  14282. +         *    We've waited for a while for all the memory associated with
  14283. +         *    the socket to be freed.
  14284. +         */
  14285. +            if(sk->wmem_alloc!=0 || sk->rmem_alloc!=0)
  14286. +            {
  14287. +                sk->wmem_alloc++;    /* So it DOESNT go away */
  14288. +                destroy_sock (sk);
  14289. +                sk->wmem_alloc--;    /* Might now have hit 0 - fall through and do it again if so */
  14290. +                sk->inuse = 0;    /* This will be ok, the destroy won't totally work */
  14291. +            }
  14292. +            if(sk->wmem_alloc==0 && sk->rmem_alloc==0)
  14293. +                destroy_sock(sk);    /* Socket gone, DONT update sk->inuse! */
  14294. +                break;
  14295. +        case TIME_CLOSE:
  14296. +            /* We've waited long enough, close the socket. */
  14297. +            sk->state = TCP_CLOSE;
  14298. +            delete_timer (sk);
  14299. +            /* Kill the ARP entry in case the hardware has changed. */
  14300. +            arp_destroy (sk->daddr, 0);
  14301. +            if (!sk->dead)
  14302. +                sk->state_change(sk);
  14303. +            sk->shutdown = SHUTDOWN_MASK;
  14304. +            reset_timer (sk, TIME_DESTROY, TCP_DONE_TIME);
  14305. +            release_sock (sk);
  14306. +            break;
  14307. +        case TIME_PROBE0:
  14308. +            tcp_send_probe0(sk);
  14309. +            release_sock (sk);
  14310. +            break;
  14311. +        case TIME_WRITE:    /* try to retransmit. */
  14312. +            /* It could be we got here because we needed to send an ack.
  14313. +             * So we need to check for that.
  14314. +             */
  14315. +        {
  14316. +            struct sk_buff *skb;
  14317. +            unsigned long flags;
  14318. +
  14319. +            save_flags(flags);
  14320. +            cli();
  14321. +            skb = sk->send_head;
  14322. +            if (!skb) 
  14323. +            {
  14324. +                restore_flags(flags);
  14325. +            } 
  14326. +            else 
  14327. +            {
  14328. +                if (jiffies < skb->when + sk->rto) 
  14329. +                {
  14330. +                    reset_timer (sk, TIME_WRITE, skb->when + sk->rto - jiffies);
  14331. +                    restore_flags(flags);
  14332. +                    release_sock (sk);
  14333. +                    break;
  14334. +                }
  14335. +                restore_flags(flags);
  14336. +                /* printk("timer: seq %d retrans %d out %d cong %d\n", sk->send_head->h.seq,
  14337. +                    sk->retransmits, sk->packets_out, sk->cong_window); */
  14338. +                sk->prot->retransmit (sk, 0);
  14339. +                if ((sk->state == TCP_ESTABLISHED && sk->retransmits && !(sk->retransmits & 7))
  14340. +                    || (sk->state != TCP_ESTABLISHED && sk->retransmits > TCP_RETR1)) 
  14341. +                {
  14342. +                    arp_destroy (sk->daddr, 0);
  14343. +                    ip_route_check (sk->daddr);
  14344. +                }
  14345. +                if (sk->state != TCP_ESTABLISHED && sk->retransmits > TCP_RETR2) 
  14346. +                {
  14347. +                    sk->err = ETIMEDOUT;
  14348. +                    if (sk->state == TCP_FIN_WAIT1 || sk->state == TCP_FIN_WAIT2 || sk->state == TCP_CLOSING) 
  14349. +                    {
  14350. +                        sk->state = TCP_TIME_WAIT;
  14351. +                        reset_timer (sk, TIME_CLOSE, TCP_TIMEWAIT_LEN);
  14352. +                    }
  14353. +                    else
  14354. +                    {
  14355. +                        sk->prot->close (sk, 1);
  14356. +                            break;
  14357. +                    }
  14358. +                }
  14359. +            }
  14360. +            release_sock (sk);
  14361. +            break;
  14362. +        }
  14363. +        case TIME_KEEPOPEN:
  14364. +        /* Send something to keep the connection open. */
  14365. +            if (sk->prot->write_wakeup)
  14366. +                  sk->prot->write_wakeup (sk);
  14367. +            sk->retransmits++;
  14368. +            if (sk->shutdown == SHUTDOWN_MASK) 
  14369. +            {
  14370. +                sk->prot->close (sk, 1);
  14371. +                sk->state = TCP_CLOSE;
  14372. +            }
  14373. +            if ((sk->state == TCP_ESTABLISHED && sk->retransmits && !(sk->retransmits & 7))
  14374. +                || (sk->state != TCP_ESTABLISHED && sk->retransmits > TCP_RETR1)) 
  14375. +            {
  14376. +                arp_destroy (sk->daddr, 0);
  14377. +                ip_route_check (sk->daddr);
  14378. +                release_sock (sk);
  14379. +                break;
  14380. +            }
  14381. +            if (sk->state != TCP_ESTABLISHED && sk->retransmits > TCP_RETR2) 
  14382. +            {
  14383. +                arp_destroy (sk->daddr, 0);
  14384. +                sk->err = ETIMEDOUT;
  14385. +                if (sk->state == TCP_FIN_WAIT1 || sk->state == TCP_FIN_WAIT2) 
  14386. +                {
  14387. +                    sk->state = TCP_TIME_WAIT;
  14388. +                    if (!sk->dead)
  14389. +                        sk->state_change(sk);
  14390. +                    release_sock (sk);
  14391. +                  } 
  14392. +                  else 
  14393. +                  {
  14394. +                    sk->prot->close (sk, 1);
  14395. +                  }
  14396. +                  break;
  14397. +            }
  14398. +            release_sock (sk);
  14399. +            break;
  14400. +        default:
  14401. +            printk ("net_timer: timer expired - reason unknown\n");
  14402. +            release_sock (sk);
  14403. +            break;
  14404.      }
  14405. -    release_sock (sk);
  14406. -    break;
  14407. -    default:
  14408. -    printk ("net_timer: timer expired - reason unknown\n");
  14409. -    release_sock (sk);
  14410. -    break;
  14411. -  }
  14412.  }
  14413.  
  14414. Only in linux.old/net/inet: timer.c.orig
  14415. diff -u --new-file --recursive linux.old/net/inet/udp.c linux/net/inet/udp.c
  14416. --- linux.old/net/inet/udp.c    Fri May 20 18:47:44 1994
  14417. +++ linux/net/inet/udp.c    Fri May 20 18:50:40 1994
  14418. @@ -37,6 +37,7 @@
  14419.   *        Alan Cox    :    SNMP Mibs
  14420.   *        Alan Cox    :    MSG_DONTROUTE, and 0.0.0.0 support.
  14421.   *        Matt Dillon    :    UDP length checks.
  14422. + *        Alan Cox    :    Smarter af_inet used properly.
  14423.   *
  14424.   *
  14425.   *        This program is free software; you can redistribute it and/or
  14426. @@ -79,20 +80,6 @@
  14427.  
  14428.  #define min(a,b)    ((a)<(b)?(a):(b))
  14429.  
  14430. -static void print_udp(struct udphdr *uh)
  14431. -{
  14432. -    if (inet_debug != DBG_UDP) 
  14433. -        return;
  14434. -
  14435. -    if (uh == NULL) 
  14436. -    {
  14437. -        printk("(NULL)\n");
  14438. -        return;
  14439. -    }
  14440. -    printk("UDP: source = %d, dest = %d\n", ntohs(uh->source), ntohs(uh->dest));
  14441. -    printk("     len = %d, check = %d\n", ntohs(uh->len), ntohs(uh->check));
  14442. -}
  14443. -
  14444.  
  14445.  /*
  14446.   * This routine is called by the ICMP module when it gets some
  14447. @@ -119,9 +106,6 @@
  14448.       */  
  14449.      th = (struct udphdr *)header;  
  14450.     
  14451. -    DPRINTF((DBG_UDP,"UDP: err(err=%d, header=%X, daddr=%X, saddr=%X, protocl=%X)\n\
  14452. -        sport=%d,dport=%d", err, header, daddr, saddr, protocol, (int)th->source,(int)th->dest));
  14453. -
  14454.      sk = get_sock(&udp_prot, th->source, daddr, th->dest, saddr);
  14455.  
  14456.      if (sk == NULL) 
  14457. @@ -134,8 +118,6 @@
  14458.          return;
  14459.      }
  14460.  
  14461. -    sk->err = icmp_err_convert[err & 0xff].errno;
  14462. -
  14463.      /*
  14464.       *    It's only fatal if we have connected to them. I'm not happy
  14465.       *    with this code. Some BSD comparisons need doing.
  14466. @@ -143,7 +125,8 @@
  14467.       
  14468.      if (icmp_err_convert[err & 0xff].fatal && sk->state == TCP_ESTABLISHED) 
  14469.      {
  14470. -        sk->err=ECONNREFUSED;
  14471. +        sk->err = icmp_err_convert[err & 0xff].errno;
  14472. +/*        sk->err=ECONNREFUSED;*/
  14473.       }
  14474.      
  14475.      sk->error_report(sk);
  14476. @@ -154,11 +137,6 @@
  14477.  {
  14478.      unsigned long sum;
  14479.  
  14480. -    DPRINTF((DBG_UDP, "UDP: check(uh=%X, len = %d, saddr = %X, daddr = %X)\n",
  14481. -                               uh, len, saddr, daddr));
  14482. -
  14483. -    print_udp(uh);
  14484. -
  14485.      __asm__(  "\t addl %%ecx,%%ebx\n"
  14486.            "\t adcl %%edx,%%ebx\n"
  14487.            "\t adcl $0, %%ebx\n"
  14488. @@ -262,14 +240,6 @@
  14489.      int size, tmp;
  14490.      int err;
  14491.    
  14492. -    DPRINTF((DBG_UDP, "UDP: send(dst=%s:%d buff=%X len=%d)\n",
  14493. -        in_ntoa(sin->sin_addr.s_addr), ntohs(sin->sin_port),
  14494. -        from, len));
  14495. -
  14496. -    err=verify_area(VERIFY_READ, from, len);
  14497. -    if(err)
  14498. -          return(err);
  14499. -
  14500.      /* 
  14501.       *    Allocate an sk_buff copy of the packet.
  14502.       */
  14503. @@ -279,7 +249,7 @@
  14504.  
  14505.  
  14506.      if (skb == NULL) 
  14507. -        return(-ENOMEM);
  14508. +        return(-ENOBUFS);
  14509.  
  14510.      skb->sk       = NULL;    /* to avoid changing sk->saddr */
  14511.      skb->free     = 1;
  14512. @@ -292,8 +262,6 @@
  14513.      buff = skb->data;
  14514.      saddr = 0;
  14515.      dev = NULL;
  14516. -    DPRINTF((DBG_UDP, "UDP: >> IP_Header: %X -> %X dev=%X prot=%X len=%d\n",
  14517. -            saddr, sin->sin_addr.s_addr, dev, IPPROTO_UDP, skb->mem_len));
  14518.      tmp = sk->prot->build_header(skb, saddr, sin->sin_addr.s_addr,
  14519.              &dev, IPPROTO_UDP, sk->opt, skb->mem_len,sk->ip_tos,sk->ip_ttl);
  14520.      skb->sk=sk;    /* So memory is freed correctly */
  14521. @@ -310,8 +278,6 @@
  14522.        
  14523.      buff += tmp;
  14524.      saddr = skb->saddr; /*dev->pa_addr;*/
  14525. -    DPRINTF((DBG_UDP, "UDP: >> MAC+IP len=%d\n", tmp));
  14526. -
  14527.      skb->len = tmp + sizeof(struct udphdr) + len;    /* len + UDP + IP + MAC */
  14528.      skb->dev = dev;
  14529.      
  14530. @@ -355,18 +321,11 @@
  14531.      int tmp;
  14532.      int err;
  14533.  
  14534. -    DPRINTF((DBG_UDP, "UDP: sendto(len=%d, flags=%X)\n", len, flags));
  14535. -
  14536.      /* 
  14537.       *    Check the flags. We support no flags for UDP sending
  14538.       */
  14539.      if (flags&~MSG_DONTROUTE) 
  14540.            return(-EINVAL);
  14541. -    if (len < 0) 
  14542. -          return(-EINVAL);
  14543. -     if (len == 0) 
  14544. -          return(0);
  14545. -
  14546.      /*
  14547.       *    Get and verify the address. 
  14548.       */
  14549. @@ -434,27 +393,6 @@
  14550.      int err;
  14551.      switch(cmd) 
  14552.      {
  14553. -        case DDIOCSDBG:
  14554. -        {
  14555. -            int val;
  14556. -
  14557. -            if (!suser()) return(-EPERM);
  14558. -            err=verify_area(VERIFY_READ, (void *)arg, sizeof(int));
  14559. -            if(err)
  14560. -                return err;
  14561. -            val = get_fs_long((int *)arg);
  14562. -            switch(val) {
  14563. -                case 0:
  14564. -                    inet_debug = 0;
  14565. -                    break;
  14566. -                case 1:
  14567. -                    inet_debug = DBG_UDP;
  14568. -                    break;
  14569. -                default:
  14570. -                    return(-EINVAL);
  14571. -            }
  14572. -        }
  14573. -        break;
  14574.          case TIOCOUTQ:
  14575.          {
  14576.              unsigned long amount;
  14577. @@ -513,26 +451,6 @@
  14578.        struct sk_buff *skb;
  14579.        int er;
  14580.  
  14581. -
  14582. -      /*
  14583. -       * This will pick up errors that occured while the program
  14584. -       * was doing something else.
  14585. -       */
  14586. -  
  14587. -      if (sk->err) 
  14588. -      {
  14589. -        int err;
  14590. -    
  14591. -        err = -sk->err;
  14592. -        sk->err = 0;
  14593. -        return(err);
  14594. -      }
  14595. -
  14596. -      if (len == 0) 
  14597. -          return(0);
  14598. -      if (len < 0) 
  14599. -          return(-EINVAL);
  14600. -
  14601.      /*
  14602.       *    Check any passed addresses
  14603.       */
  14604. @@ -552,14 +470,6 @@
  14605.                return(er);
  14606.        }
  14607.        
  14608. -      /*
  14609. -       *    Check the buffer we were given
  14610. -       */
  14611. -       
  14612. -      er=verify_area(VERIFY_WRITE,to,len);
  14613. -    if(er)
  14614. -        return er;
  14615. -    
  14616.      /*
  14617.       *    From here the generic datagram does a lot of the work. Come
  14618.       *    the finished NET3, it will do _ALL_ the work!
  14619. @@ -672,7 +582,6 @@
  14620.      if (ulen > len || len < sizeof(*uh) || ulen < sizeof(*uh)) 
  14621.      {
  14622.          printk("UDP: short packet: %d/%d\n", ulen, len);
  14623. -        DPRINTF((DBG_UDP, "UDP: short packet %d/%d\n", ulen, len));
  14624.          udp_statistics.UdpInErrors++;
  14625.          kfree_skb(skb, FREE_WRITE);
  14626.          return(0);
  14627. @@ -699,7 +608,6 @@
  14628.      if (uh->check && udp_check(uh, len, saddr, daddr)) 
  14629.      {
  14630.          printk("UDP: bad checksum.\n");
  14631. -        DPRINTF((DBG_UDP, "UDP: bad checksum\n"));
  14632.          udp_statistics.UdpInErrors++;
  14633.          kfree_skb(skb, FREE_WRITE);
  14634.          return(0);
  14635. @@ -733,13 +641,6 @@
  14636.      }
  14637.      sk->rmem_alloc += skb->mem_len;
  14638.        udp_statistics.UdpInDatagrams++;
  14639. -      
  14640. -    /*
  14641. -     *    At this point we should print the thing out. 
  14642. -     */
  14643. -
  14644. -    DPRINTF((DBG_UDP, "<< \n"));
  14645. -    print_udp(uh);
  14646.  
  14647.      /*
  14648.       *    Now add it to the data chain and wake things up. 
  14649. Only in linux.old/net/inet: udp.c.orig
  14650. diff -u --new-file --recursive linux.old/net/inet/utils.c linux/net/inet/utils.c
  14651. --- linux.old/net/inet/utils.c    Fri May 20 18:42:59 1994
  14652. +++ linux/net/inet/utils.c    Fri May 20 18:50:40 1994
  14653. @@ -12,6 +12,7 @@
  14654.   *
  14655.   * Fixes:
  14656.   *        Alan Cox    :    verify_area check.
  14657. + *        Alan Cox    :    removed old debugging.
  14658.   *
  14659.   *
  14660.   *        This program is free software; you can redistribute it and/or
  14661. @@ -88,80 +89,3 @@
  14662.      return(htonl(l));
  14663.  }
  14664.  
  14665. -
  14666. -/*
  14667. - *    Debugging print out
  14668. - */
  14669. -void dprintf(int level, char *fmt, ...)
  14670. -{
  14671. -    va_list args;
  14672. -    char *buff;
  14673. -    extern int vsprintf(char * buf, const char * fmt, va_list args);
  14674. -
  14675. -    if (level != inet_debug) 
  14676. -        return;
  14677. -
  14678. -    buff = (char *) kmalloc(256, GFP_ATOMIC);
  14679. -    if (buff != NULL) 
  14680. -    {
  14681. -        va_start(args, fmt);
  14682. -        vsprintf(buff, fmt, args);
  14683. -        va_end(args);
  14684. -        printk(buff);
  14685. -        kfree(buff);
  14686. -      }
  14687. -      else
  14688. -        printk("Debugging output lost: No free memory.\n");      
  14689. -}
  14690. -
  14691. -/*
  14692. - *    Debugging ioctl() requests
  14693. - */
  14694. -int dbg_ioctl(void *arg, int level)
  14695. -{
  14696. -    int val;
  14697. -    int err;
  14698. -  
  14699. -    if (!suser()) 
  14700. -        return(-EPERM);
  14701. -    err=verify_area(VERIFY_READ, (void *)arg, sizeof(int));
  14702. -    if(err)
  14703. -          return err;
  14704. -    val = get_fs_long((int *)arg);
  14705. -    switch(val) 
  14706. -    {
  14707. -        case 0:    /* OFF */
  14708. -            inet_debug = DBG_OFF;
  14709. -            break;
  14710. -        case 1:    /* ON, INET */
  14711. -            inet_debug = level;
  14712. -            break;
  14713. -
  14714. -        case DBG_RT:        /* modules */
  14715. -        case DBG_DEV:
  14716. -        case DBG_ETH:
  14717. -        case DBG_PROTO:
  14718. -        case DBG_TMR:
  14719. -        case DBG_PKT:
  14720. -        case DBG_RAW:
  14721. -    
  14722. -        case DBG_LOOPB:        /* drivers */
  14723. -        case DBG_SLIP:
  14724. -    
  14725. -        case DBG_ARP:        /* protocols */
  14726. -        case DBG_IP:
  14727. -        case DBG_ICMP:
  14728. -        case DBG_TCP:
  14729. -        case DBG_UDP:
  14730. -    
  14731. -            inet_debug = val;
  14732. -            break;
  14733. -    
  14734. -        default:
  14735. -            return(-EINVAL);
  14736. -    }
  14737. -    
  14738. -    return(0);
  14739. -}
  14740. Only in linux.old/net/inet: utils.c.orig
  14741. diff -u --new-file --recursive linux.old/net/protocols.c linux/net/protocols.c
  14742. --- linux.old/net/protocols.c    Thu Jan  1 01:00:00 1970
  14743. +++ linux/net/protocols.c    Fri May 20 18:51:01 1994
  14744. @@ -0,0 +1,50 @@
  14745. +/*
  14746. + *    Protocol intialiser table. Here seperately for convenience
  14747. + *
  14748. + */
  14749. +#include <linux/config.h>
  14750. +#include <linux/types.h>
  14751. +#include <linux/kernel.h>
  14752. +#include <linux/net.h>
  14753. +
  14754. +
  14755. +#define CONFIG_UNIX        /* always present...    */
  14756. +
  14757. +#ifdef    CONFIG_UNIX
  14758. +#include "unix/unix.h"
  14759. +#endif
  14760. +#ifdef    CONFIG_INET
  14761. +#include <linux/inet.h>
  14762. +#endif
  14763. +#ifdef CONFIG_IPX
  14764. +#include "inet/ipxcall.h"
  14765. +#include "inet/p8022call.h"
  14766. +#endif
  14767. +#ifdef CONFIG_AX25
  14768. +#include "inet/ax25call.h"
  14769. +#endif
  14770. +
  14771. +/*
  14772. + *    Protocol Table
  14773. + */
  14774. +struct net_proto protocols[] = {
  14775. +#ifdef    CONFIG_UNIX
  14776. +  { "UNIX",    unix_proto_init    },
  14777. +#endif
  14778. +#ifdef  CONFIG_IPX
  14779. +  { "IPX",    ipx_proto_init },
  14780. +  { "802.2",    p8022_proto_init },
  14781. +#endif
  14782. +#ifdef CONFIG_AX25  
  14783. +  { "AX.25",    ax25_proto_init },
  14784. +#endif  
  14785. +#ifdef    CONFIG_INET
  14786. +  { "INET",    inet_proto_init    },
  14787. +#endif
  14788. +  { NULL,    NULL        }
  14789. +};
  14790. +
  14791. +
  14792. diff -u --new-file --recursive linux.old/net/socket.c linux/net/socket.c
  14793. --- linux.old/net/socket.c    Fri May 20 18:47:06 1994
  14794. +++ linux/net/socket.c    Fri May 20 18:50:55 1994
  14795. @@ -11,6 +11,8 @@
  14796.   *        Anonymous    :    NOTSOCK/BADF cleanup. Error fix in
  14797.   *                    shutdown()
  14798.   *        Alan Cox    :    verify_area() fixes
  14799. + *        Alan Cox    :     Removed DDI
  14800. + *        Jonathan Kamens    :    SOCK_DGRAM reconnect bug
  14801.   *
  14802.   *
  14803.   *        This program is free software; you can redistribute it and/or
  14804. @@ -37,20 +39,12 @@
  14805.  #include <linux/socket.h>
  14806.  #include <linux/fcntl.h>
  14807.  #include <linux/net.h>
  14808. -#include <linux/ddi.h>
  14809. +#include <linux/interrupt.h>
  14810. +#include <linux/netdevice.h>
  14811.  
  14812.  #include <asm/system.h>
  14813.  #include <asm/segment.h>
  14814.  
  14815. -#undef SOCK_DEBUG
  14816. -
  14817. -#ifdef SOCK_DEBUG
  14818. -#include <stdarg.h>
  14819. -#define DPRINTF(x) dprintf x
  14820. -#else
  14821. -#define DPRINTF(x) /**/
  14822. -#endif
  14823. -
  14824.  static int sock_lseek(struct inode *inode, struct file *file, off_t offset,
  14825.                int whence);
  14826.  static int sock_read(struct inode *inode, struct file *file, char *buf,
  14827. @@ -80,27 +74,9 @@
  14828.  static struct socket sockets[NSOCKETS];
  14829.  static struct wait_queue *socket_wait_free = NULL;
  14830.  static struct proto_ops *pops[NPROTO];
  14831. -static int net_debug = 0;
  14832.  
  14833.  #define last_socket    (sockets + NSOCKETS - 1)
  14834.  
  14835. -#ifdef SOCK_DEBUG
  14836. -/* Module debugging. */
  14837. -static void
  14838. -dprintf(int level, char *fmt, ...)
  14839. -{
  14840. -  char buff[1024];
  14841. -  va_list args;
  14842. -  extern int vsprintf(char * buf, const char * fmt, va_list args);
  14843. -
  14844. -  if (level == 0) return;
  14845. -  va_start(args, fmt);
  14846. -  vsprintf(buff, fmt, args);
  14847. -  va_end(args);
  14848. -  printk(buff);
  14849. -}
  14850. -#endif
  14851. -
  14852.  /* Obtains the first available file descriptor and sets it up for use. */
  14853.  static int
  14854.  get_fd(struct inode *inode)
  14855. @@ -207,21 +183,15 @@
  14856.              SOCK_INODE(sock)->i_socket = sock;
  14857.  
  14858.              sock->wait = &SOCK_INODE(sock)->i_wait;
  14859. -            DPRINTF((net_debug,
  14860. -                "NET: sock_alloc: sk 0x%x, ino 0x%x\n",
  14861. -                                   sock, SOCK_INODE(sock)));
  14862.              return(sock);
  14863.          }
  14864.      }
  14865.      sti();
  14866.      if (!wait) return(NULL);
  14867. -    DPRINTF((net_debug, "NET: sock_alloc: no free sockets, sleeping...\n"));
  14868.      interruptible_sleep_on(&socket_wait_free);
  14869.      if (current->signal & ~current->blocked) {
  14870. -        DPRINTF((net_debug, "NET: sock_alloc: sleep was interrupted\n"));
  14871.          return(NULL);
  14872.      }
  14873. -    DPRINTF((net_debug, "NET: sock_alloc: wakeup... trying again...\n"));
  14874.    }
  14875.  }
  14876.  
  14877. @@ -241,8 +211,6 @@
  14878.    struct inode *inode;
  14879.    struct socket *peersock, *nextsock;
  14880.  
  14881. -  DPRINTF((net_debug, "NET: sock_release: socket 0x%x, inode 0x%x\n",
  14882. -                        sock, SOCK_INODE(sock)));
  14883.    if ((oldstate = sock->state) != SS_UNCONNECTED)
  14884.              sock->state = SS_DISCONNECTING;
  14885.  
  14886. @@ -271,7 +239,6 @@
  14887.  static int
  14888.  sock_lseek(struct inode *inode, struct file *file, off_t offset, int whence)
  14889.  {
  14890. -  DPRINTF((net_debug, "NET: sock_lseek: huh?\n"));
  14891.    return(-ESPIPE);
  14892.  }
  14893.  
  14894. @@ -281,7 +248,6 @@
  14895.  {
  14896.    struct socket *sock;
  14897.  
  14898. -  DPRINTF((net_debug, "NET: sock_read: buf=0x%x, size=%d\n", ubuf, size));
  14899.    if (!(sock = socki_lookup(inode))) {
  14900.      printk("NET: sock_read: can't find socket for inode!\n");
  14901.      return(-EBADF);
  14902. @@ -296,7 +262,6 @@
  14903.  {
  14904.    struct socket *sock;
  14905.  
  14906. -  DPRINTF((net_debug, "NET: sock_write: buf=0x%x, size=%d\n", ubuf, size));
  14907.    if (!(sock = socki_lookup(inode))) {
  14908.      printk("NET: sock_write: can't find socket for inode!\n");
  14909.      return(-EBADF);
  14910. @@ -310,7 +275,6 @@
  14911.  sock_readdir(struct inode *inode, struct file *file, struct dirent *dirent,
  14912.           int count)
  14913.  {
  14914. -  DPRINTF((net_debug, "NET: sock_readdir: huh?\n"));
  14915.    return(-EBADF);
  14916.  }
  14917.  
  14918. @@ -321,8 +285,6 @@
  14919.  {
  14920.    struct socket *sock;
  14921.  
  14922. -  DPRINTF((net_debug, "NET: sock_ioctl: inode=0x%x cmd=0x%x arg=%d\n",
  14923. -                            inode, cmd, arg));
  14924.    if (!(sock = socki_lookup(inode))) {
  14925.      printk("NET: sock_ioctl: can't find socket for inode!\n");
  14926.      return(-EBADF);
  14927. @@ -336,9 +298,6 @@
  14928.  {
  14929.    struct socket *sock;
  14930.  
  14931. -  DPRINTF((net_debug, "NET: sock_select: inode = 0x%x, kind = %s\n", inode,
  14932. -       (sel_type == SEL_IN) ? "in" :
  14933. -       (sel_type == SEL_OUT) ? "out" : "ex"));
  14934.    if (!(sock = socki_lookup(inode))) {
  14935.      printk("NET: sock_select: can't find socket for inode!\n");
  14936.      return(0);
  14937. @@ -356,9 +315,6 @@
  14938.  {
  14939.    struct socket *sock;
  14940.  
  14941. -  DPRINTF((net_debug, "NET: sock_close: inode=0x%x (cnt=%d)\n",
  14942. -                        inode, inode->i_count));
  14943. -
  14944.    /* It's possible the inode is NULL if we're closing an unfinished socket. */
  14945.    if (!inode) return;
  14946.    if (!(sock = socki_lookup(inode))) {
  14947. @@ -374,12 +330,7 @@
  14948.  {
  14949.    struct socket *last;
  14950.  
  14951. -  DPRINTF((net_debug,
  14952. -    "NET: sock_awaitconn: trying to connect socket 0x%x to 0x%x\n",
  14953. -                            mysock, servsock));
  14954.    if (!(servsock->flags & SO_ACCEPTCON)) {
  14955. -    DPRINTF((net_debug,
  14956. -        "NET: sock_awaitconn: server not accepting connections\n"));
  14957.      return(-EINVAL);
  14958.    }
  14959.  
  14960. @@ -439,18 +390,13 @@
  14961.    struct socket *sock;
  14962.    struct proto_ops *ops;
  14963.  
  14964. -  DPRINTF((net_debug,
  14965. -    "NET: sock_socket: family = %d, type = %d, protocol = %d\n",
  14966. -                        family, type, protocol));
  14967. -
  14968.    /* Locate the correct protocol family. */
  14969.    for (i = 0; i < NPROTO; ++i) {
  14970.      if (pops[i] == NULL) continue;
  14971.      if (pops[i]->family == family) break;
  14972.    }
  14973.    if (i == NPROTO) {
  14974. -    DPRINTF((net_debug, "NET: sock_socket: family not found\n"));
  14975. -    return(-EINVAL);
  14976. +      return -EINVAL;
  14977.    }
  14978.    ops = pops[i];
  14979.  
  14980. @@ -496,10 +442,6 @@
  14981.    struct socket *sock1, *sock2;
  14982.    int er;
  14983.  
  14984. -  DPRINTF((net_debug,
  14985. -    "NET: sock_socketpair: family = %d, type = %d, protocol = %d\n",
  14986. -                            family, type, protocol));
  14987. -
  14988.    /*
  14989.     * Obtain the first socket and check if the underlying protocol
  14990.     * supports the socketpair call.
  14991. @@ -547,12 +489,10 @@
  14992.    struct socket *sock;
  14993.    int i;
  14994.  
  14995. -  DPRINTF((net_debug, "NET: sock_bind: fd = %d\n", fd));
  14996.    if (fd < 0 || fd >= NR_OPEN || current->files->fd[fd] == NULL)
  14997.                                  return(-EBADF);
  14998.    if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);
  14999.    if ((i = sock->ops->bind(sock, umyaddr, addrlen)) < 0) {
  15000. -    DPRINTF((net_debug, "NET: sock_bind: bind failed\n"));
  15001.      return(i);
  15002.    }
  15003.    return(0);
  15004. @@ -569,12 +509,10 @@
  15005.  {
  15006.    struct socket *sock;
  15007.  
  15008. -  DPRINTF((net_debug, "NET: sock_listen: fd = %d\n", fd));
  15009.    if (fd < 0 || fd >= NR_OPEN || current->files->fd[fd] == NULL)
  15010.                                  return(-EBADF);
  15011.    if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);
  15012.    if (sock->state != SS_UNCONNECTED) {
  15013. -    DPRINTF((net_debug, "NET: sock_listen: socket isn't unconnected\n"));
  15014.      return(-EINVAL);
  15015.    }
  15016.    if (sock->ops && sock->ops->listen) sock->ops->listen(sock, backlog);
  15017. @@ -595,18 +533,14 @@
  15018.    struct socket *sock, *newsock;
  15019.    int i;
  15020.  
  15021. -  DPRINTF((net_debug, "NET: sock_accept: fd = %d\n", fd));
  15022.    if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL))
  15023.                                  return(-EBADF);
  15024.    
  15025.    if (!(sock = sockfd_lookup(fd, &file))) return(-ENOTSOCK);
  15026.    if (sock->state != SS_UNCONNECTED) {
  15027. -    DPRINTF((net_debug, "NET: sock_accept: socket isn't unconnected\n"));
  15028.      return(-EINVAL);
  15029.    }
  15030.    if (!(sock->flags & SO_ACCEPTCON)) {
  15031. -    DPRINTF((net_debug,
  15032. -        "NET: sock_accept: socket not accepting connections!\n"));
  15033.      return(-EINVAL);
  15034.    }
  15035.  
  15036. @@ -632,9 +566,6 @@
  15037.      return(-EINVAL);
  15038.    }
  15039.  
  15040. -  DPRINTF((net_debug, "NET: sock_accept: connected socket 0x%x via 0x%x\n",
  15041. -                            sock, newsock));
  15042. -
  15043.    if (upeer_sockaddr)
  15044.      newsock->ops->getname(newsock, upeer_sockaddr, upeer_addrlen, 1);
  15045.  
  15046. @@ -650,7 +581,6 @@
  15047.    struct file *file;
  15048.    int i;
  15049.  
  15050. -  DPRINTF((net_debug, "NET: sock_connect: fd = %d\n", fd));
  15051.    if (fd < 0 || fd >= NR_OPEN || (file=current->files->fd[fd]) == NULL)
  15052.                                  return(-EBADF);
  15053.    
  15054. @@ -661,19 +591,24 @@
  15055.          break;
  15056.      case SS_CONNECTED:
  15057.          /* Socket is already connected */
  15058. +        if(sock->type == SOCK_DGRAM) /* Hack for now - move this all into the protocol */
  15059. +            break;
  15060.          return -EISCONN;
  15061.      case SS_CONNECTING:
  15062.          /* Not yet connected... we will check this. */
  15063. +        
  15064. +        /*
  15065. +         *    FIXME:  for all protocols what happens if you start
  15066. +         *    an async connect fork and both children connect. Clean
  15067. +         *    this up in the protocols!
  15068. +         */
  15069.          return(sock->ops->connect(sock, uservaddr,
  15070.                        addrlen, file->f_flags));
  15071.      default:
  15072. -        DPRINTF((net_debug,
  15073. -            "NET: sock_connect: socket not unconnected\n"));
  15074.          return(-EINVAL);
  15075.    }
  15076.    i = sock->ops->connect(sock, uservaddr, addrlen, file->f_flags);
  15077.    if (i < 0) {
  15078. -    DPRINTF((net_debug, "NET: sock_connect: connect failed\n"));
  15079.      return(i);
  15080.    }
  15081.    return(0);
  15082. @@ -685,7 +620,6 @@
  15083.  {
  15084.    struct socket *sock;
  15085.  
  15086. -  DPRINTF((net_debug, "NET: sock_getsockname: fd = %d\n", fd));
  15087.    if (fd < 0 || fd >= NR_OPEN || current->files->fd[fd] == NULL)
  15088.                                  return(-EBADF);
  15089.    if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);
  15090. @@ -698,7 +632,6 @@
  15091.  {
  15092.    struct socket *sock;
  15093.  
  15094. -  DPRINTF((net_debug, "NET: sock_getpeername: fd = %d\n", fd));
  15095.    if (fd < 0 || fd >= NR_OPEN || current->files->fd[fd] == NULL)
  15096.              return(-EBADF);
  15097.    if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);
  15098. @@ -712,10 +645,6 @@
  15099.    struct socket *sock;
  15100.    struct file *file;
  15101.  
  15102. -  DPRINTF((net_debug,
  15103. -    "NET: sock_send(fd = %d, buff = %X, len = %d, flags = %X)\n",
  15104. -                                   fd, buff, len, flags));
  15105. -
  15106.    if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL))
  15107.                                  return(-EBADF);
  15108.    if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);
  15109. @@ -731,10 +660,6 @@
  15110.    struct socket *sock;
  15111.    struct file *file;
  15112.  
  15113. -  DPRINTF((net_debug,
  15114. -    "NET: sock_sendto(fd = %d, buff = %X, len = %d, flags = %X,"
  15115. -     " addr=%X, alen = %d\n", fd, buff, len, flags, addr, addr_len));
  15116. -
  15117.    if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL))
  15118.                                  return(-EBADF);
  15119.    if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);
  15120. @@ -750,10 +675,6 @@
  15121.    struct socket *sock;
  15122.    struct file *file;
  15123.  
  15124. -  DPRINTF((net_debug,
  15125. -    "NET: sock_recv(fd = %d, buff = %X, len = %d, flags = %X)\n",
  15126. -                            fd, buff, len, flags));
  15127. -
  15128.    if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL))
  15129.                                  return(-EBADF);
  15130.    if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);
  15131. @@ -769,10 +690,6 @@
  15132.    struct socket *sock;
  15133.    struct file *file;
  15134.  
  15135. -  DPRINTF((net_debug,
  15136. -    "NET: sock_recvfrom(fd = %d, buff = %X, len = %d, flags = %X,"
  15137. -    " addr=%X, alen=%X\n", fd, buff, len, flags, addr, addr_len));
  15138. -
  15139.    if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL))
  15140.                                  return(-EBADF);
  15141.    if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);
  15142. @@ -788,11 +705,6 @@
  15143.    struct socket *sock;
  15144.    struct file *file;
  15145.      
  15146. -  DPRINTF((net_debug, "NET: sock_setsockopt(fd=%d, level=%d, optname=%d,\n",
  15147. -                            fd, level, optname));
  15148. -  DPRINTF((net_debug, "                     optval = %X, optlen = %d)\n",
  15149. -                            optval, optlen));
  15150. -
  15151.    if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL))
  15152.                                  return(-EBADF);
  15153.    if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);
  15154. @@ -807,11 +719,6 @@
  15155.    struct socket *sock;
  15156.    struct file *file;
  15157.  
  15158. -  DPRINTF((net_debug, "NET: sock_getsockopt(fd=%d, level=%d, optname=%d,\n",
  15159. -                        fd, level, optname));
  15160. -  DPRINTF((net_debug, "                     optval = %X, optlen = %X)\n",
  15161. -                        optval, optlen));
  15162. -
  15163.    if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL))
  15164.                                  return(-EBADF);
  15165.    if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);
  15166. @@ -827,8 +734,6 @@
  15167.    struct socket *sock;
  15168.    struct file *file;
  15169.  
  15170. -  DPRINTF((net_debug, "NET: sock_shutdown(fd = %d, how = %d)\n", fd, how));
  15171. -
  15172.    if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL))
  15173.                                  return(-EBADF);
  15174.  
  15175. @@ -981,74 +886,6 @@
  15176.    }
  15177.  }
  15178.  
  15179. -
  15180. -static int
  15181. -net_ioctl(unsigned int cmd, unsigned long arg)
  15182. -{
  15183. -  int er;
  15184. -  switch(cmd) {
  15185. -    case DDIOCSDBG:
  15186. -        er=verify_area(VERIFY_READ, (void *)arg, sizeof(long));
  15187. -        if(er)
  15188. -            return er;
  15189. -        net_debug = get_fs_long((long *)arg);
  15190. -        if (net_debug != 0 && net_debug != 1) {
  15191. -            net_debug = 0;
  15192. -            return(-EINVAL);
  15193. -        }
  15194. -        return(0);
  15195. -    default:
  15196. -        return(-EINVAL);
  15197. -  }
  15198. -  /*NOTREACHED*/
  15199. -  return(0);
  15200. -}
  15201. -
  15202. -
  15203. -/*
  15204. - * Handle the IOCTL system call for the NET devices.  This basically
  15205. - * means I/O control for the SOCKET layer (future expansions could be
  15206. - * a variable number of socket table entries, et al), and for the more
  15207. - * general protocols like ARP.  The latter currently lives in the INET
  15208. - * module, so we have to get ugly a tiny little bit.  Later... -FvK
  15209. - */
  15210. -static int
  15211. -net_fioctl(struct inode *inode, struct file *file,
  15212. -       unsigned int cmd, unsigned long arg)
  15213. -{
  15214. -  extern int arp_ioctl(unsigned int, void *);
  15215. -
  15216. -  /* Dispatch on the minor device. */
  15217. -  switch(MINOR(inode->i_rdev)) {
  15218. -    case 0:        /* NET (SOCKET) */
  15219. -        DPRINTF((net_debug, "NET: SOCKET level I/O control request.\n"));
  15220. -        return(net_ioctl(cmd, arg));
  15221. -#ifdef CONFIG_INET
  15222. -    case 1:        /* ARP */
  15223. -        DPRINTF((net_debug, "NET: ARP level I/O control request.\n"));
  15224. -        return(arp_ioctl(cmd, (void *) arg));
  15225. -#endif
  15226. -    default:
  15227. -        return(-ENODEV);
  15228. -  }
  15229. -  /*NOTREACHED*/
  15230. -  return(-EINVAL);
  15231. -}
  15232. -
  15233. -
  15234. -static struct file_operations net_fops = {
  15235. -  NULL,        /* LSEEK    */
  15236. -  NULL,        /* READ        */
  15237. -  NULL,        /* WRITE    */
  15238. -  NULL,        /* READDIR    */
  15239. -  NULL,        /* SELECT    */
  15240. -  net_fioctl,    /* IOCTL    */
  15241. -  NULL,        /* MMAP        */
  15242. -  NULL,        /* OPEN        */
  15243. -  NULL        /* CLOSE    */
  15244. -};
  15245. -
  15246. -
  15247.  /*
  15248.   * This function is called by a protocol handler that wants to
  15249.   * advertise its address family, and have it linked into the
  15250. @@ -1065,38 +902,46 @@
  15251.      pops[i] = ops;
  15252.      pops[i]->family = family;
  15253.      sti();
  15254. -    DPRINTF((net_debug, "NET: Installed protocol %d in slot %d (0x%X)\n",
  15255. -                        family, i, (long)ops));
  15256.      return(i);
  15257.    }
  15258.    sti();
  15259.    return(-ENOMEM);
  15260.  }
  15261.  
  15262. +void proto_init(void)
  15263. +{
  15264. +    extern struct net_proto protocols[];    /* Network protocols */
  15265. +    struct net_proto *pro;
  15266. +
  15267. +    /* Kick all configured protocols. */
  15268. +    pro = protocols;
  15269. +    while (pro->name != NULL) 
  15270. +    {
  15271. +        (*pro->init_func)(pro);
  15272. +        pro++;
  15273. +    }
  15274. +    /* We're all done... */
  15275. +}
  15276. +
  15277.  
  15278.  void
  15279.  sock_init(void)
  15280.  {
  15281.    struct socket *sock;
  15282.    int i;
  15283. -
  15284. -  /* Set up our SOCKET VFS major device. */
  15285. -  if (register_chrdev(SOCKET_MAJOR, "socket", &net_fops) < 0) {
  15286. -    printk("NET: cannot register major device %d!\n", SOCKET_MAJOR);
  15287. -    return;
  15288. -  }
  15289. -
  15290.    /* Release all sockets. */
  15291.    for (sock = sockets; sock <= last_socket; ++sock) sock->state = SS_FREE;
  15292.  
  15293.    /* Initialize all address (protocol) families. */
  15294.    for (i = 0; i < NPROTO; ++i) pops[i] = NULL;
  15295.  
  15296. -  /* Initialize the DDI module. */
  15297. -  ddi_init();
  15298. +  /* Initialize the protocols module. */
  15299. +  proto_init();
  15300.  
  15301. -  /* Initialize the ARP module. */
  15302. -#if 0
  15303. -  arp_init();
  15304. -#endif
  15305. +  /* Initialize the DEV module. */
  15306. +  dev_init();
  15307. +  
  15308. +  /* And the bottom half handler */
  15309. +  bh_base[NET_BH].routine= net_bh;
  15310. +  
  15311.  }
  15312. Only in linux.old/net: socket.c.orig
  15313. diff -u --new-file --recursive linux.old/net/unix/proc.c linux/net/unix/proc.c
  15314. --- linux.old/net/unix/proc.c    Fri May 20 18:43:00 1994
  15315. +++ linux/net/unix/proc.c    Fri May 20 18:50:55 1994
  15316. @@ -17,6 +17,8 @@
  15317.   *
  15318.   * Fixes:
  15319.   *        Dmitry Gorodchanin    :    /proc locking fix
  15320. + *        Mathijs Maassen        :    unbound /proc fix.
  15321. + *        Alan Cox        :    Fix sock=NULL race
  15322.   *
  15323.   *        This program is free software; you can redistribute it and/or
  15324.   *        modify it under the terms of the GNU General Public License
  15325. @@ -28,7 +30,6 @@
  15326.  #include <linux/string.h>
  15327.  #include <linux/socket.h>
  15328.  #include <linux/net.h>
  15329. -#include <linux/ddi.h>
  15330.  #include <linux/un.h>
  15331.  #include <linux/param.h>
  15332.  #include "unix.h"
  15333. @@ -41,19 +42,30 @@
  15334.        off_t begin=0;
  15335.        int len=0;
  15336.        int i;
  15337. -
  15338. +      unsigned long flags;
  15339. +    socket_state s_state;
  15340. +    short s_type;
  15341. +    long s_flags;
  15342. +    
  15343.        len += sprintf(buffer, "Num RefCount Protocol Flags    Type St Path\n");
  15344.  
  15345.        for(i = 0; i < NSOCKETS; i++) 
  15346.        {
  15347. -        if (unix_datas[i].refcnt>0) 
  15348. +          save_flags(flags);
  15349. +          cli();
  15350. +        if (unix_datas[i].refcnt>0 && unix_datas[i].socket!=NULL)
  15351.          {
  15352. +            /* sprintf is slow... lock only for the variable reads */
  15353. +            s_type=unix_datas[i].socket->type;
  15354. +            s_flags=unix_datas[i].socket->flags;
  15355. +            s_state=unix_datas[i].socket->state;
  15356. +            restore_flags(flags);
  15357.              len += sprintf(buffer+len, "%2d: %08X %08X %08lX %04X %02X", i,
  15358.                  unix_datas[i].refcnt,
  15359.                  unix_datas[i].protocol,
  15360. -                unix_datas[i].socket->flags,
  15361. -                unix_datas[i].socket->type,
  15362. -                unix_datas[i].socket->state
  15363. +                s_flags,
  15364. +                s_type,
  15365. +                s_state
  15366.              );
  15367.  
  15368.              /* If socket is bound to a filename, we'll print it. */
  15369. @@ -65,7 +77,6 @@
  15370.              else 
  15371.              { /* just add a newline */
  15372.                  buffer[len++]='\n';
  15373. -                buffer[len++]='\0';
  15374.              }
  15375.              
  15376.              pos=begin+len;
  15377. @@ -77,6 +88,8 @@
  15378.              if(pos>offset+length)
  15379.                  break;
  15380.          }
  15381. +        else
  15382. +            restore_flags(flags);
  15383.      }
  15384.      
  15385.      *start=buffer+(offset-begin);
  15386. Only in linux.old/net/unix: proc.c.orig
  15387. diff -u --new-file --recursive linux.old/net/unix/sock.c linux/net/unix/sock.c
  15388. --- linux.old/net/unix/sock.c    Fri May 20 18:43:01 1994
  15389. +++ linux/net/unix/sock.c    Fri May 20 18:50:55 1994
  15390. @@ -42,7 +42,6 @@
  15391.  #include <linux/sockios.h>
  15392.  #include <linux/net.h>
  15393.  #include <linux/fs.h>
  15394. -#include <linux/ddi.h>
  15395.  #include <linux/malloc.h>
  15396.  
  15397.  #include <asm/system.h>
  15398. @@ -53,9 +52,7 @@
  15399.  #include "unix.h"
  15400.  
  15401.  struct unix_proto_data unix_datas[NSOCKETS];
  15402. -static int unix_debug = 0;
  15403.  
  15404. -
  15405.  static int unix_proto_create(struct socket *sock, int protocol);
  15406.  static int unix_proto_dup(struct socket *newsock, struct socket *oldsock);
  15407.  static int unix_proto_release(struct socket *sock, struct socket *peer);
  15408. @@ -95,26 +92,6 @@
  15409.                    char *optval, int *optlen);
  15410.  
  15411.  
  15412. -static void
  15413. -dprintf(int level, char *fmt, ...)
  15414. -{
  15415. -  va_list args;
  15416. -  char *buff;
  15417. -  extern int vsprintf(char * buf, const char * fmt, va_list args);
  15418. -
  15419. -  if (level != unix_debug) return;
  15420. -
  15421. -  buff = (char *) kmalloc(256, GFP_KERNEL);
  15422. -  if (buff != NULL) {
  15423. -    va_start(args, fmt);
  15424. -    vsprintf(buff, fmt, args);
  15425. -    va_end(args);
  15426. -    printk(buff);
  15427. -    kfree(buff);
  15428. -  }
  15429. -}
  15430. -
  15431. -
  15432.  static inline int
  15433.  min(int a, int b)
  15434.  {
  15435. @@ -123,25 +100,6 @@
  15436.  }
  15437.  
  15438.  
  15439. -void
  15440. -sockaddr_un_printk(struct sockaddr_un *sockun, int sockaddr_len)
  15441. -{
  15442. -  char buf[sizeof(sockun->sun_path) + 1];
  15443. -
  15444. -  if (unix_debug == 0) return;
  15445. -
  15446. -  sockaddr_len -= UN_PATH_OFFSET;
  15447. -  if (sockun->sun_family != AF_UNIX)
  15448. -    printk("UNIX: Badd addr family %d>\n", sockun->sun_family);
  15449. -    else if (sockaddr_len <= 0 || sockaddr_len >= sizeof(buf))
  15450. -    printk("UNIX: Bad addr len %d>\n", sockaddr_len);
  15451. -    else {
  15452. -    memcpy(buf, sockun->sun_path, sockaddr_len);
  15453. -    buf[sockaddr_len] = '\0';
  15454. -    printk("\"%s\"[%lu]\n", buf, sockaddr_len + UN_PATH_OFFSET);
  15455. -  }
  15456. -}
  15457. -  
  15458.  
  15459.  /* Support routines doing anti page fault locking 
  15460.   * FvK & Matt Dillon (borrowed From NET2E3)
  15461. @@ -152,7 +110,7 @@
  15462.   * wait queue because it is allowed to 'go away' outside of our control,
  15463.   * whereas unix_proto_data structures stick around.
  15464.   */
  15465. -void unix_lock(struct unix_proto_data *upd)
  15466. +static void unix_lock(struct unix_proto_data *upd)
  15467.  {
  15468.      while (upd->lock_flag)
  15469.          sleep_on(&upd->wait);
  15470. @@ -160,7 +118,7 @@
  15471.  }
  15472.  
  15473.  
  15474. -void unix_unlock(struct unix_proto_data *upd)
  15475. +static void unix_unlock(struct unix_proto_data *upd)
  15476.  {
  15477.      upd->lock_flag = 0;
  15478.      wake_up(&upd->wait);
  15479. @@ -276,11 +234,9 @@
  15480.  unix_data_ref(struct unix_proto_data *upd)
  15481.  {
  15482.    if (!upd) {
  15483. -    dprintf(1, "UNIX: data_ref: upd = NULL\n");
  15484.      return;
  15485.    }
  15486.    ++upd->refcnt;
  15487. -  dprintf(1, "UNIX: data_ref: refing data 0x%x(%d)\n", upd, upd->refcnt);
  15488.  }
  15489.  
  15490.  
  15491. @@ -288,11 +244,9 @@
  15492.  unix_data_deref(struct unix_proto_data *upd)
  15493.  {
  15494.    if (!upd) {
  15495. -    dprintf(1, "UNIX: data_deref: upd = NULL\n");
  15496.      return;
  15497.    }
  15498.    if (upd->refcnt == 1) {
  15499. -    dprintf(1, "UNIX: data_deref: releasing data 0x%x\n", upd);
  15500.      if (upd->buf) {
  15501.          free_page((unsigned long)upd->buf);
  15502.          upd->buf = NULL;
  15503. @@ -312,9 +266,7 @@
  15504.  {
  15505.    struct unix_proto_data *upd;
  15506.  
  15507. -  dprintf(1, "UNIX: create: socket 0x%x, proto %d\n", sock, protocol);
  15508.    if (protocol != 0) {
  15509. -    dprintf(1, "UNIX: create: protocol != 0\n");
  15510.      return(-EINVAL);
  15511.    }
  15512.    if (!(upd = unix_data_alloc())) {
  15513. @@ -330,7 +282,6 @@
  15514.    upd->socket = sock;
  15515.    UN_DATA(sock) = upd;
  15516.    upd->refcnt = 1;    /* Now its complete - bgm */
  15517. -  dprintf(1, "UNIX: create: allocated data 0x%x\n", upd);
  15518.    return(0);
  15519.  }
  15520.  
  15521. @@ -349,14 +300,12 @@
  15522.  {
  15523.    struct unix_proto_data *upd = UN_DATA(sock);
  15524.  
  15525. -  dprintf(1, "UNIX: release: socket 0x%x, unix_data 0x%x\n", sock, upd);
  15526.    if (!upd) return(0);
  15527.    if (upd->socket != sock) {
  15528.      printk("UNIX: release: socket link mismatch!\n");
  15529.      return(-EINVAL);
  15530.    }
  15531.    if (upd->inode) {
  15532. -    dprintf(1, "UNIX: release: releasing inode 0x%x\n", upd->inode);
  15533.      iput(upd->inode);
  15534.      upd->inode = NULL;
  15535.    }
  15536. @@ -387,10 +336,8 @@
  15537.    int i;
  15538.    int er;
  15539.  
  15540. -  dprintf(1, "UNIX: bind: socket 0x%x, len=%d\n", sock, sockaddr_len);
  15541.    if (sockaddr_len <= UN_PATH_OFFSET ||
  15542.        sockaddr_len > sizeof(struct sockaddr_un)) {
  15543. -    dprintf(1, "UNIX: bind: bad length %d\n", sockaddr_len);
  15544.      return(-EINVAL);
  15545.    }
  15546.    if (upd->sockaddr_len || upd->inode) {
  15547. @@ -403,8 +350,6 @@
  15548.    memcpy_fromfs(&upd->sockaddr_un, umyaddr, sockaddr_len);
  15549.    upd->sockaddr_un.sun_path[sockaddr_len-UN_PATH_OFFSET] = '\0';
  15550.    if (upd->sockaddr_un.sun_family != AF_UNIX) {
  15551. -    dprintf(1, "UNIX: bind: family is %d, not AF_UNIX(%d)\n",
  15552. -                       upd->sockaddr_un.sun_family, AF_UNIX);
  15553.      return(-EINVAL);
  15554.    }
  15555.  
  15556. @@ -421,9 +366,6 @@
  15557.    }
  15558.    upd->sockaddr_len = sockaddr_len;    /* now its legal */
  15559.  
  15560. -  dprintf(1, "UNIX: bind: bound socket address: ");
  15561. -  sockaddr_un_printk(&upd->sockaddr_un, upd->sockaddr_len);
  15562. -  dprintf(1, "to inode 0x%x\n", upd->inode);
  15563.    return(0);
  15564.  }
  15565.  
  15566. @@ -445,11 +387,8 @@
  15567.    int i;
  15568.    int er;
  15569.  
  15570. -  dprintf(1, "UNIX: connect: socket 0x%x, servlen=%d\n", sock, sockaddr_len);
  15571. -
  15572.    if (sockaddr_len <= UN_PATH_OFFSET ||
  15573.        sockaddr_len > sizeof(struct sockaddr_un)) {
  15574. -    dprintf(1, "UNIX: connect: bad length %d\n", sockaddr_len);
  15575.      return(-EINVAL);
  15576.    }
  15577.    if (sock->state == SS_CONNECTING) return(-EINPROGRESS);
  15578. @@ -461,8 +400,6 @@
  15579.    memcpy_fromfs(&sockun, uservaddr, sockaddr_len);
  15580.    sockun.sun_path[sockaddr_len-UN_PATH_OFFSET] = '\0';
  15581.    if (sockun.sun_family != AF_UNIX) {
  15582. -    dprintf(1, "UNIX: connect: family is %d, not AF_UNIX(%d)\n",
  15583. -                               sockun.sun_family, AF_UNIX);
  15584.      return(-EINVAL);
  15585.    }
  15586.  
  15587. @@ -479,18 +416,15 @@
  15588.    i = open_namei(fname, 0, S_IFSOCK, &inode, NULL);
  15589.    set_fs(old_fs);
  15590.    if (i < 0) {
  15591. -    dprintf(1, "UNIX: connect: can't open socket %s\n", fname);
  15592.      return(i);
  15593.    }
  15594. +      
  15595.    serv_upd = unix_data_lookup(&sockun, sockaddr_len, inode);
  15596.    iput(inode);
  15597.    if (!serv_upd) {
  15598. -    dprintf(1, "UNIX: connect: can't locate peer %s at inode 0x%x\n",
  15599. -                                fname, inode);
  15600.      return(-EINVAL);
  15601.    }
  15602.    if ((i = sock_awaitconn(sock, serv_upd->socket)) < 0) {
  15603. -    dprintf(1, "UNIX: connect: can't await connection\n");
  15604.      return(i);
  15605.    }
  15606.    if (sock->conn) {
  15607. @@ -526,9 +460,6 @@
  15608.  {
  15609.    struct socket *clientsock;
  15610.  
  15611. -  dprintf(1, "UNIX: accept: socket 0x%x accepted via socket 0x%x\n",
  15612. -                            sock, newsock);
  15613. -
  15614.    /*
  15615.     * If there aren't any sockets awaiting connection,
  15616.     * then wait for one, unless nonblocking.
  15617. @@ -537,7 +468,6 @@
  15618.      if (flags & O_NONBLOCK) return(-EAGAIN);
  15619.      interruptible_sleep_on(sock->wait);
  15620.      if (current->signal & ~current->blocked) {
  15621. -        dprintf(1, "UNIX: accept: sleep was interrupted\n");
  15622.          return(-ERESTARTSYS);
  15623.      }
  15624.    }
  15625. @@ -570,10 +500,8 @@
  15626.    int len;
  15627.    int er;
  15628.  
  15629. -  dprintf(1, "UNIX: getname: socket 0x%x for %s\n", sock, peer?"peer":"self");
  15630.    if (peer) {
  15631.      if (sock->state != SS_CONNECTED) {
  15632. -        dprintf(1, "UNIX: getname: socket not connected\n");
  15633.          return(-EINVAL);
  15634.      }
  15635.      upd = UN_DATA(sock->conn);
  15636. @@ -608,14 +536,11 @@
  15637.    upd = UN_DATA(sock);
  15638.    while(!(avail = UN_BUF_AVAIL(upd))) {
  15639.      if (sock->state != SS_CONNECTED) {
  15640. -        dprintf(1, "UNIX: read: socket not connected\n");
  15641.          return((sock->state == SS_DISCONNECTING) ? 0 : -EINVAL);
  15642.      }
  15643. -    dprintf(1, "UNIX: read: no data available...\n");
  15644.      if (nonblock) return(-EAGAIN);
  15645.      interruptible_sleep_on(sock->wait);
  15646.      if (current->signal & ~current->blocked) {
  15647. -        dprintf(1, "UNIX: read: interrupted\n");
  15648.          return(-ERESTARTSYS);
  15649.      }
  15650.    }
  15651. @@ -637,8 +562,6 @@
  15652.  
  15653.      if ((cando = todo) > avail) cando = avail;
  15654.      if (cando >(part = BUF_SIZE - upd->bp_tail)) cando = part;
  15655. -    dprintf(1, "UNIX: read: avail=%d, todo=%d, cando=%d\n",
  15656. -                               avail, todo, cando);
  15657.      if((er=verify_area(VERIFY_WRITE,ubuf,cando))<0)
  15658.      {
  15659.          unix_unlock(upd);
  15660. @@ -671,7 +594,6 @@
  15661.  
  15662.    if ((todo = size) <= 0) return(0);
  15663.    if (sock->state != SS_CONNECTED) {
  15664. -    dprintf(1, "UNIX: write: socket not connected\n");
  15665.      if (sock->state == SS_DISCONNECTING) {
  15666.          send_sig(SIGPIPE, current, 1);
  15667.          return(-EPIPE);
  15668. @@ -681,15 +603,12 @@
  15669.    pupd = UN_DATA(sock)->peerupd;    /* safer than sock->conn */
  15670.  
  15671.    while(!(space = UN_BUF_SPACE(pupd))) {
  15672. -    dprintf(1, "UNIX: write: no space left...\n");
  15673.      if (nonblock) return(-EAGAIN);
  15674.      interruptible_sleep_on(sock->wait);
  15675.      if (current->signal & ~current->blocked) {
  15676. -        dprintf(1, "UNIX: write: interrupted\n");
  15677.          return(-ERESTARTSYS);
  15678.      }
  15679.      if (sock->state == SS_DISCONNECTING) {
  15680. -        dprintf(1, "UNIX: write: disconnected(SIGPIPE)\n");
  15681.          send_sig(SIGPIPE, current, 1);
  15682.          return(-EPIPE);
  15683.      }
  15684. @@ -722,8 +641,6 @@
  15685.      }
  15686.      if ((cando = todo) > space) cando = space;
  15687.      if (cando >(part = BUF_SIZE - pupd->bp_head)) cando = part;
  15688. -    dprintf(1, "UNIX: write: space=%d, todo=%d, cando=%d\n",
  15689. -                               space, todo, cando);
  15690.      er=verify_area(VERIFY_READ, ubuf, cando);
  15691.      if(er)
  15692.      {
  15693. @@ -751,25 +668,19 @@
  15694.    /* Handle server sockets specially. */
  15695.    if (sock->flags & SO_ACCEPTCON) {
  15696.      if (sel_type == SEL_IN) {
  15697. -        dprintf(1, "UNIX: select: %sconnections pending\n",
  15698. -                               sock->iconn ? "" : "no ");
  15699.          if (sock->iconn) return(1);
  15700.          select_wait(sock->wait, wait);
  15701.          return(sock->iconn ? 1 : 0);
  15702.      }
  15703. -    dprintf(1, "UNIX: select: nothing else for server socket\n");
  15704.      select_wait(sock->wait, wait);
  15705.      return(0);
  15706.    }
  15707.  
  15708.    if (sel_type == SEL_IN) {
  15709.      upd = UN_DATA(sock);
  15710. -    dprintf(1, "UNIX: select: there is%s data available\n",
  15711. -                               UN_BUF_AVAIL(upd) ? "" : " no");
  15712.      if (UN_BUF_AVAIL(upd))    /* even if disconnected */
  15713.              return(1);
  15714.      else if (sock->state != SS_CONNECTED) {
  15715. -        dprintf(1, "UNIX: select: socket not connected(read EOF)\n");
  15716.          return(1);
  15717.      }
  15718.      select_wait(sock->wait,wait);
  15719. @@ -777,19 +688,15 @@
  15720.    }
  15721.    if (sel_type == SEL_OUT) {
  15722.      if (sock->state != SS_CONNECTED) {
  15723. -        dprintf(1, "UNIX: select: socket not connected(write EOF)\n");
  15724.          return(1);
  15725.      }
  15726.      peerupd = UN_DATA(sock->conn);
  15727. -    dprintf(1, "UNIX: select: there is%s space available\n",
  15728. -                           UN_BUF_SPACE(peerupd) ? "" : " no");
  15729.      if (UN_BUF_SPACE(peerupd) > 0) return(1);
  15730.      select_wait(sock->wait,wait);
  15731.      return(0);
  15732.    }
  15733.  
  15734.    /* SEL_EX */
  15735. -  dprintf(1, "UNIX: select: there are no exceptions here?!\n");
  15736.    return(0);
  15737.  }
  15738.  
  15739. @@ -831,74 +738,6 @@
  15740.  }
  15741.  
  15742.  
  15743. -static int
  15744. -unix_open(struct inode * inode, struct file * file)
  15745. -{
  15746. -  int minor;
  15747. -
  15748. -  dprintf(1, "UNIX: open\n");
  15749. -  minor = MINOR(inode->i_rdev);
  15750. -  if (minor != 0) return(-ENODEV);
  15751. -
  15752. -  return(0);
  15753. -}
  15754. -
  15755. -
  15756. -static void
  15757. -unix_close(struct inode * inode, struct file * file)
  15758. -{
  15759. -  dprintf(1, "UNIX: close\n");
  15760. -}
  15761. -
  15762. -
  15763. -static int
  15764. -unix_ioctl(struct inode *inode, struct file *file,
  15765. -     unsigned int cmd, unsigned long arg)
  15766. -{
  15767. -  int minor, ret;
  15768. -  int er;
  15769. -
  15770. -  dprintf(1, "UNIX: ioctl(0x%X, 0x%X)\n", cmd, arg);
  15771. -  minor = MINOR(inode->i_rdev);
  15772. -  if (minor != 0) return(-ENODEV);
  15773. -
  15774. -  ret = -EINVAL;
  15775. -  switch(cmd) {
  15776. -    case DDIOCSDBG:
  15777. -        er=verify_area(VERIFY_READ,(void *)arg, sizeof(int));
  15778. -        if(er)
  15779. -            return er;
  15780. -        unix_debug = get_fs_long((int *)arg);
  15781. -        if (unix_debug != 0 && unix_debug != 1) {
  15782. -            unix_debug = 0;
  15783. -            return(-EINVAL);
  15784. -        }
  15785. -        return(0);
  15786. -    case SIOCSIFLINK:
  15787. -        printk("UNIX: cannot link streams!\n");
  15788. -        break;
  15789. -    default:
  15790. -        break;
  15791. -  }
  15792. -  return(ret);
  15793. -}
  15794. -
  15795. -
  15796. -
  15797. -
  15798. -static struct file_operations unix_fops = {
  15799. -  NULL,        /* LSEEK    */
  15800. -  NULL,        /* READ        */
  15801. -  NULL,        /* WRITE    */
  15802. -  NULL,        /* READDIR    */
  15803. -  NULL,        /* SELECT    */
  15804. -  unix_ioctl,    /* IOCTL    */
  15805. -  NULL,        /* MMAP        */
  15806. -  unix_open,    /* OPEN        */
  15807. -  unix_close    /* CLOSE    */
  15808. -};
  15809. -
  15810. -
  15811.  static struct proto_ops unix_proto_ops = {
  15812.    AF_UNIX,
  15813.    unix_proto_create,
  15814. @@ -926,16 +765,9 @@
  15815.  
  15816.  
  15817.  void
  15818. -unix_proto_init(struct ddi_proto *pro)
  15819. +unix_proto_init(struct net_proto *pro)
  15820.  {
  15821.    struct unix_proto_data *upd;
  15822. -
  15823. -  dprintf(1, "%s: init: initializing...\n", pro->name);
  15824. -  if (register_chrdev(AF_UNIX_MAJOR, "af_unix", &unix_fops) < 0) {
  15825. -    printk("%s: cannot register major device %d!\n",
  15826. -                        pro->name, AF_UNIX_MAJOR);
  15827. -    return;
  15828. -  }
  15829.  
  15830.    /* Tell SOCKET that we are alive... */
  15831.    (void) sock_register(unix_proto_ops.family, &unix_proto_ops);
  15832. Only in linux.old/net/unix: sock.c.orig
  15833. diff -u --new-file --recursive linux.old/net/unix/unix.h linux/net/unix/unix.h
  15834. --- linux.old/net/unix/unix.h    Fri Mar  4 07:25:21 1994
  15835. +++ linux/net/unix/unix.h    Fri May 20 18:50:55 1994
  15836. @@ -66,4 +66,4 @@
  15837.  #endif    /* _LINUX_UN_H */
  15838.  
  15839.  
  15840. -extern void    unix_proto_init(struct ddi_proto *pro);
  15841. +extern void    unix_proto_init(struct net_proto *pro);
  15842. diff -u --new-file --recursive linux.old/patch.modules linux/patch.modules
  15843. --- linux.old/patch.modules    Thu Jan  1 01:00:00 1970
  15844. +++ linux/patch.modules    Fri May 20 18:51:57 1994
  15845. @@ -0,0 +1,410 @@
  15846. +*** linux/drivers/net/3c509.c.org    Sun May 14 21:01:50 2023
  15847. +--- linux/drivers/net/3c509.c    Sun May 14 21:01:26 2023
  15848. +***************
  15849. +*** 31,36 ****
  15850. +--- 31,40 ----
  15851. +  #include <linux/netdevice.h>
  15852. +  #include <linux/etherdevice.h>
  15853. +  #include <linux/skbuff.h>
  15854. ++ #ifdef MODULE
  15855. ++ #include <linux/module.h>
  15856. ++ #include "../../tools/version.h"
  15857. ++ #endif
  15858. +  
  15859. +  
  15860. +  
  15861. +***************
  15862. +*** 199,205 ****
  15863. +--- 203,216 ----
  15864. +      printk(", IRQ %d.\n", dev->irq);
  15865. +  
  15866. +      /* Make up a EL3-specific-data structure. */
  15867. ++ #ifdef MODULE
  15868. ++     {
  15869. ++     static struct el3_private module_private;
  15870. ++     dev->priv = &module_private;
  15871. ++     }
  15872. ++ #else
  15873. +      dev->priv = kmalloc(sizeof(struct el3_private), GFP_KERNEL);
  15874. ++ #endif
  15875. +      memset(dev->priv, 0, sizeof(struct el3_private));
  15876. +  
  15877. +      if (el3_debug > 0)
  15878. +***************
  15879. +*** 312,317 ****
  15880. +--- 323,331 ----
  15881. +          printk("%s: Opened 3c509  IRQ %d  status %4.4x.\n",
  15882. +                 dev->name, dev->irq, inw(ioaddr + EL3_STATUS));
  15883. +  
  15884. ++ #ifdef MODULE
  15885. ++     MOD_INC_USE_COUNT;
  15886. ++ #endif
  15887. +      return 0;                    /* Always succeed */
  15888. +  }
  15889. +  
  15890. +***************
  15891. +*** 645,650 ****
  15892. +--- 659,667 ----
  15893. +      irq2dev_map[dev->irq] = 0;
  15894. +  
  15895. +      update_stats(ioaddr, dev);
  15896. ++ #ifdef MODULE
  15897. ++     MOD_DEC_USE_COUNT;
  15898. ++ #endif
  15899. +      return 0;
  15900. +  }
  15901. +  
  15902. +***************
  15903. +*** 656,658 ****
  15904. +--- 673,697 ----
  15905. +   *  tab-width: 4
  15906. +   * End:
  15907. +   */
  15908. ++ #ifdef MODULE
  15909. ++ char kernel_version[] = UTS_RELEASE;
  15910. ++ static struct device dev_3c509 = {
  15911. ++     "" /*"3c509"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, el3_probe };
  15912. ++ 
  15913. ++ int
  15914. ++ init_module(void)
  15915. ++ {
  15916. ++     if (register_netdev(&dev_3c509) != 0)
  15917. ++         return -EIO;
  15918. ++     return 0;
  15919. ++ }
  15920. ++ 
  15921. ++ void
  15922. ++ cleanup_module(void)
  15923. ++ {
  15924. ++     if (MOD_IN_USE)
  15925. ++         printk("3c509: device busy, remove delayed\n");
  15926. ++     else
  15927. ++         unregister_netdev(&dev_3c509);
  15928. ++ }
  15929. ++ #endif /* MODULE */
  15930. +*** linux/drivers/net/CONFIG.org    Sun May 14 21:02:57 2023
  15931. +--- linux/drivers/net/CONFIG    Sun May 14 21:01:26 2023
  15932. +***************
  15933. +*** 26,35 ****
  15934. +  #  CONFIG_PLIP        The Crynwr-protocol PL/IP driver
  15935. +  #    INITIALTIMEOUTFACTOR    Timing parameters.
  15936. +  #    MAXTIMEOUTFACTOR
  15937. +! #  D_LINK        The D-Link DE-600 Portable Ethernet Adaptor.
  15938. +! #      D_LINK_IO    The D-Link I/O address (0x378 == typical)
  15939. +! #      D_LINK_IRQ    The D-Link IRQ number to use (IRQ7 == typical)
  15940. +! #      D_LINK_DEBUG    Enable or disable D-Link debugging
  15941. +  #  DEPCA        The DIGITAL series of AT Ethernet Cards (DE100, DE200)
  15942. +  #      DEPCA_IRQ    Set the desired IRQ (=0, for autoprobe)
  15943. +  #      DEPCA_DEBUG    Set the desired debug level
  15944. +--- 26,35 ----
  15945. +  #  CONFIG_PLIP        The Crynwr-protocol PL/IP driver
  15946. +  #    INITIALTIMEOUTFACTOR    Timing parameters.
  15947. +  #    MAXTIMEOUTFACTOR
  15948. +! #  DE600        The D-Link DE-600 Portable Ethernet Adaptor.
  15949. +! #      DE600_IO    The DE600 I/O-port address (0x378 == default)
  15950. +! #      DE600_IRQ    The DE600 IRQ number to use (IRQ7 == default)
  15951. +! #      DE600_DEBUG    Enable or disable DE600 debugging (default off)
  15952. +  #  DEPCA        The DIGITAL series of AT Ethernet Cards (DE100, DE200)
  15953. +  #      DEPCA_IRQ    Set the desired IRQ (=0, for autoprobe)
  15954. +  #      DEPCA_DEBUG    Set the desired debug level
  15955. +***************
  15956. +*** 54,59 ****
  15957. +  HP_OPTS        =
  15958. +  PLIP_OPTS    =
  15959. +  DEPCA_OPTS    = -DDEPCA_IRQ=0 -DDEPCA_DEBUG=1
  15960. +- 
  15961. +- # The following are the only parameters that must be set in this file.
  15962. +- DL_OPTS        = -DD_LINK_IO=0x378 -DD_LINK_IRQ=7 -UD_LINK_DEBUG
  15963. +--- 54,56 ----
  15964. +*** linux/drivers/net/MODULES.org    Sun May 14 21:03:23 2023
  15965. +--- linux/drivers/net/MODULES    Sun May 14 21:03:12 2023
  15966. +***************
  15967. +*** 0 ****
  15968. +--- 1,3 ----
  15969. ++ MODULES = \
  15970. ++     3c509.o \
  15971. ++     de600.o
  15972. +*** linux/drivers/net/Makefile.org    Sun May 14 21:02:00 2023
  15973. +--- linux/drivers/net/Makefile    Sun May 14 21:01:26 2023
  15974. +***************
  15975. +*** 6,11 ****
  15976. +--- 6,12 ----
  15977. +  # This will go away in some future future: hidden configuration files
  15978. +  # are difficult for users to deal with.
  15979. +  include CONFIG
  15980. ++ include MODULES
  15981. +  
  15982. +  NETDRV_OBJS := net.a(Space.o) net.a(auto_irq.o) net.a(net_init.o) net.a(loopback.o)
  15983. +  CFLAGS := $(CFLAGS) -I../../net/inet
  15984. +***************
  15985. +*** 12,21 ****
  15986. +  CPP := $(CPP) -I../../net/inet
  15987. +  
  15988. +  # The point of the makefile...
  15989. +! all: net.a
  15990. +  
  15991. +  Space.o: Space.c ../../include/linux/autoconf.h
  15992. +!     $(CC) $(CFLAGS) $(OPTS) $(DL_OPTS) -c $< -o $@
  15993. +  
  15994. +  net_init.o: ../../include/linux/autoconf.h
  15995. +  
  15996. +--- 13,22 ----
  15997. +  CPP := $(CPP) -I../../net/inet
  15998. +  
  15999. +  # The point of the makefile...
  16000. +! all: net.a modules
  16001. +  
  16002. +  Space.o: Space.c ../../include/linux/autoconf.h
  16003. +!     $(CC) $(CFLAGS) $(OPTS) -c $< -o $@
  16004. +  
  16005. +  net_init.o: ../../include/linux/autoconf.h
  16006. +  
  16007. +***************
  16008. +*** 74,84 ****
  16009. +  endif
  16010. +  
  16011. +  ifdef CONFIG_DE600
  16012. +! NETDRV_OBJS := $(NETDRV_OBJS) net.a(d_link.o)
  16013. +! d_link.o: d_link.c CONFIG
  16014. +!     $(CC) $(CPPFLAGS) $(CFLAGS) $(DL_OPTS) -c $<
  16015. +  endif
  16016. +- 
  16017. +  ifdef CONFIG_AT1500
  16018. +  NETDRV_OBJS := $(NETDRV_OBJS) net.a(lance.o)
  16019. +  endif
  16020. +--- 75,82 ----
  16021. +  endif
  16022. +  
  16023. +  ifdef CONFIG_DE600
  16024. +! NETDRV_OBJS := $(NETDRV_OBJS) net.a(de600.o)
  16025. +  endif
  16026. +  ifdef CONFIG_AT1500
  16027. +  NETDRV_OBJS := $(NETDRV_OBJS) net.a(lance.o)
  16028. +  endif
  16029. +***************
  16030. +*** 144,149 ****
  16031. +--- 142,159 ----
  16032. +  
  16033. +  tar:
  16034. +  
  16035. ++ ifdef MODULES
  16036. ++ 
  16037. ++ modules:
  16038. ++     echo $(MODULES) > ../../modules/NET_MODULES
  16039. ++     $(MAKE) CFLAGS="$(CFLAGS) -DMODULE" $(MODULES)
  16040. ++     (cd ../../modules;for i in $(MODULES); do ln -sf ../drivers/net/$$i .; done)
  16041. ++ 
  16042. ++ else
  16043. ++ 
  16044. ++ modules:
  16045. ++ 
  16046. ++ endif
  16047. +  
  16048. +  # include a dependency file if one exists
  16049. +  
  16050. +*** linux/drivers/net/Space.c.org    Sun May 14 21:02:30 2023
  16051. +--- linux/drivers/net/Space.c    Sun May 14 21:01:26 2023
  16052. +***************
  16053. +*** 56,62 ****
  16054. +  
  16055. +  /* Detachable devices ("pocket adaptors" and special PCMCIA drivers). */
  16056. +  extern int atp_init(struct device *);
  16057. +! extern int d_link_init(struct device *);
  16058. +  
  16059. +  static int
  16060. +  ethif_probe(struct device *dev)
  16061. +--- 56,62 ----
  16062. +  
  16063. +  /* Detachable devices ("pocket adaptors" and special PCMCIA drivers). */
  16064. +  extern int atp_init(struct device *);
  16065. +! extern int de600_probe(struct device *);
  16066. +  
  16067. +  static int
  16068. +  ethif_probe(struct device *dev)
  16069. +***************
  16070. +*** 115,120 ****
  16071. +--- 115,123 ----
  16072. +  #ifdef CONFIG_E2100        /* Cabletron E21xx series. */
  16073. +      && e2100_probe(dev)
  16074. +  #endif
  16075. ++ #ifdef CONFIG_DE600
  16076. ++     && de600_probe(dev)
  16077. ++ #endif
  16078. +      && 1 ) {
  16079. +      return 1;    /* -ENODEV or -EAGAIN would be more accurate. */
  16080. +      }
  16081. +***************
  16082. +*** 121,134 ****
  16083. +      return 0;
  16084. +  }
  16085. +  
  16086. +- 
  16087. +- /* This remains seperate because it requires the addr and IRQ to be set. */
  16088. +- #if defined(D_LINK) || defined(CONFIG_DE600)
  16089. +- static struct device d_link_dev = {
  16090. +-     "dl0", 0, 0, 0, 0, D_LINK_IO, D_LINK_IRQ, 0, 0, 0, NEXT_DEV, d_link_init };
  16091. +- #   undef NEXT_DEV
  16092. +- #   define NEXT_DEV    (&d_link_dev)
  16093. +- #endif
  16094. +  
  16095. +  /* Run-time ATtachable (Pocket) devices have a different (not "eth#") name. */
  16096. +  #ifdef CONFIG_ATP        /* AT-LAN-TEC (RealTek) pocket adaptor. */
  16097. +--- 124,129 ----
  16098. +*** linux/drivers/net/net_init.c.org    Sun May 14 21:02:14 2023
  16099. +--- linux/drivers/net/net_init.c    Sun May 14 21:01:26 2023
  16100. +***************
  16101. +*** 14,19 ****
  16102. +--- 14,21 ----
  16103. +      It's primary advantage is that it's able to allocate low-memory buffers.
  16104. +      A secondary advantage is that the dangerous NE*000 netcards can reserve
  16105. +      their I/O port region before the SCSI probes start.
  16106. ++ 
  16107. ++     register_netdev()/unregister_netdev() by Bjorn Ekwall <bj0rn@blox.se>
  16108. +  */
  16109. +  
  16110. +  #include <linux/config.h>
  16111. +***************
  16112. +*** 161,166 ****
  16113. +--- 163,220 ----
  16114. +      dev->pa_alen    = sizeof(unsigned long);
  16115. +  }
  16116. +  
  16117. ++ int register_netdev(struct device *dev)
  16118. ++ {
  16119. ++     struct device *d = dev_base;
  16120. ++ 
  16121. ++     if (dev && dev->init) {
  16122. ++         if (dev->init(dev) != 0)
  16123. ++              return -EIO;
  16124. ++ 
  16125. ++         if (dev->name  &&  dev->name[0] == '\0')
  16126. ++             sprintf(dev->name, "eth%d", next_ethdev_number++);
  16127. ++ 
  16128. ++         /* Add device to end of chain */
  16129. ++         if (dev_base) {
  16130. ++             while (d->next)
  16131. ++                 d = d->next;
  16132. ++             d->next = dev;
  16133. ++         }
  16134. ++         else
  16135. ++             dev_base = dev;
  16136. ++         dev->next = NULL;
  16137. ++     }
  16138. ++     return 0;
  16139. ++ }
  16140. ++ 
  16141. ++ void unregister_netdev(struct device *dev)
  16142. ++ {
  16143. ++     struct device *d = dev_base;
  16144. ++ 
  16145. ++     printk("unregister_netdev: device ");
  16146. ++     if (dev) {
  16147. ++         if (dev->start)
  16148. ++             printk("'%s' busy", dev->name);
  16149. ++         else {
  16150. ++             if (dev_base == dev)
  16151. ++                 dev_base = dev->next;
  16152. ++             else {
  16153. ++                 while (d && (d->next != dev))
  16154. ++                     d = d->next;
  16155. ++ 
  16156. ++                 if (d && (d->next == dev)) {
  16157. ++                     d->next = dev->next;
  16158. ++                     printk("'%s' unlinked", dev->name);
  16159. ++                 }
  16160. ++                 else
  16161. ++                     printk("'%s' not found", dev->name);
  16162. ++             }
  16163. ++         }
  16164. ++     }
  16165. ++     else
  16166. ++         printk("was NULL");
  16167. ++     printk("\n");
  16168. ++ }
  16169. +  
  16170. +  
  16171. +  /*
  16172. +*** linux/include/linux/netdevice.h.org    Sun May 14 18:36:27 2023
  16173. +--- linux/include/linux/netdevice.h    Sun May 14 18:39:44 2023
  16174. +***************
  16175. +*** 12,17 ****
  16176. +--- 12,18 ----
  16177. +   *        Corey Minyard <wf-rch!minyard@relay.EU.net>
  16178. +   *        Donald J. Becker, <becker@super.org>
  16179. +   *        Alan Cox, <A.Cox@swansea.ac.uk>
  16180. ++  *        Bjorn Ekwall. <bj0rn@blox.se>
  16181. +   *
  16182. +   *        This program is free software; you can redistribute it and/or
  16183. +   *        modify it under the terms of the GNU General Public License
  16184. +***************
  16185. +*** 186,191 ****
  16186. +--- 187,195 ----
  16187. +  /* This function lives elsewhere (drivers/net/net_init.c but is related) */
  16188. +  
  16189. +  extern void        ether_setup(struct device *dev);
  16190. ++ /* Support for loadable net-drivers */
  16191. ++ extern int        register_netdev(struct device *dev);
  16192. ++ extern void        unregister_netdev(struct device *dev);
  16193. +  
  16194. +  #endif /* __KERNEL__ */
  16195. +  
  16196. +*** linux/kernel/ksyms.c.org    Sat May 13 21:32:22 2023
  16197. +--- linux/kernel/ksyms.c    Sun May 14 21:10:42 2023
  16198. +***************
  16199. +*** 14,19 ****
  16200. +--- 14,22 ----
  16201. +  #include <linux/ptrace.h>
  16202. +  #include <linux/sys.h>
  16203. +  #include <linux/utsname.h>
  16204. ++ #ifdef CONFIG_INET
  16205. ++ #include <linux/netdevice.h>
  16206. ++ #endif
  16207. +    
  16208. +  extern void *sys_call_table;
  16209. +  
  16210. +***************
  16211. +*** 38,43 ****
  16212. +--- 41,59 ----
  16213. +  
  16214. +  extern void (* iABI_hook)(struct pt_regs * regs);
  16215. +  #endif
  16216. ++ #ifdef CONFIG_INET
  16217. ++ extern int register_netdev(struct device *);
  16218. ++ extern void unregister_netdev(struct device *);
  16219. ++ extern void ether_setup(struct device *);
  16220. ++ extern struct sk_buff *alloc_skb(unsigned int,int);
  16221. ++ extern void kfree_skb(struct sk_buff *, int);
  16222. ++ extern void snarf_region(unsigned int, unsigned int);
  16223. ++ extern void netif_rx(struct sk_buff *);
  16224. ++ extern int dev_rint(unsigned char *, long, int, struct device *);
  16225. ++ extern void dev_tint(struct device *);
  16226. ++ extern struct device *irq2dev_map[];
  16227. ++ extern unsigned long bh_active;
  16228. ++ #endif
  16229. +  
  16230. +  struct {
  16231. +      void *addr;
  16232. +***************
  16233. +*** 131,136 ****
  16234. +--- 147,167 ----
  16235. +  
  16236. +      /* Miscellaneous access points */
  16237. +      X(si_meminfo),
  16238. ++ #endif
  16239. ++ 
  16240. ++ #ifdef CONFIG_INET
  16241. ++     /* support for loadable net drivers */
  16242. ++     X(register_netdev),
  16243. ++     X(unregister_netdev),
  16244. ++     X(ether_setup),
  16245. ++     X(alloc_skb),
  16246. ++     X(kfree_skb),
  16247. ++     X(snarf_region),
  16248. ++     X(netif_rx),
  16249. ++     X(dev_rint),
  16250. ++     X(dev_tint),
  16251. ++     X(irq2dev_map),
  16252. ++     X(bh_active),
  16253. +  #endif
  16254. +  };
  16255. +  
  16256. Binary files linux.old/tools/build and linux/tools/build differ
  16257. diff -u --new-file --recursive linux.old/tools/version.h linux/tools/version.h
  16258. --- linux.old/tools/version.h    Thu Jan  1 01:00:00 1970
  16259. +++ linux/tools/version.h    Fri May 20 18:50:19 1994
  16260. @@ -0,0 +1,6 @@
  16261. +#define UTS_RELEASE "1.1.12"
  16262. +#define UTS_VERSION "#38 Fri May 20 12:59:04 BST 1994"
  16263. +#define LINUX_COMPILE_TIME "12:59:05"
  16264. +#define LINUX_COMPILE_BY "root"
  16265. +#define LINUX_COMPILE_HOST "iifeak"
  16266. +#define LINUX_COMPILE_DOMAIN "swan.ac.uk"
  16267. Binary files linux.old/tools/zSystem and linux/tools/zSystem differ
  16268. diff -u --new-file --recursive linux.old/zBoot/head.s linux/zBoot/head.s
  16269. --- linux.old/zBoot/head.s    Thu Jan  1 01:00:00 1970
  16270. +++ linux/zBoot/head.s    Fri May 20 18:51:04 1994
  16271. @@ -0,0 +1,71 @@
  16272. +# 1 "head.S"
  16273. +
  16274. +
  16275. +
  16276. +
  16277. +
  16278. +
  16279. +
  16280. +
  16281. +
  16282. +
  16283. +
  16284. +
  16285. +
  16286. +
  16287. +
  16288. +
  16289. +
  16290. +
  16291. +.text
  16292. +
  16293. +# 1 "/usr/src/v11/linux/include/linux/segment.h" 1
  16294. +
  16295. +
  16296. +
  16297. +
  16298. +
  16299. +
  16300. +
  16301. +
  16302. +
  16303. +
  16304. +# 21 "head.S" 2
  16305. +
  16306. +
  16307. +startup_32:
  16308. +    cld
  16309. +    cli
  16310. +    movl $(0x18),%eax
  16311. +    mov %ax,%ds
  16312. +    mov %ax,%es
  16313. +    mov %ax,%fs
  16314. +    mov %ax,%gs
  16315. +    lss _stack_start,%esp
  16316. +    xorl %eax,%eax
  16317. +1:    incl %eax        # check that A20 really IS enabled
  16318. +    movl %eax,0x000000    # loop forever if it isn't
  16319. +    cmpl %eax,0x100000
  16320. +    je 1b
  16321. +
  16322. +
  16323. +
  16324. +
  16325. +
  16326. +    pushl $0
  16327. +    popfl
  16328. +
  16329. +
  16330. +
  16331. +    xorl %eax,%eax
  16332. +    movl $__edata,%edi
  16333. +    movl $__end,%ecx
  16334. +    subl %edi,%ecx
  16335. +    cld
  16336. +    rep
  16337. +    stosb
  16338. +
  16339. +
  16340. +
  16341. +    call _decompress_kernel
  16342. +    ljmp $(0x10), $0x100000
  16343. Binary files linux.old/zBoot/piggyback and linux/zBoot/piggyback differ
  16344. Binary files linux.old/zBoot/xtract and linux/zBoot/xtract differ
  16345. Binary files linux.old/zBoot/zSystem and linux/zBoot/zSystem differ
  16346.